Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error on unique constraint #773

Closed
binajmen opened this issue Jan 8, 2024 · 1 comment
Closed

Fatal error on unique constraint #773

binajmen opened this issue Jan 8, 2024 · 1 comment

Comments

@binajmen
Copy link

binajmen commented Jan 8, 2024

I'm using postgres in the context of a Remix application using Drizzle.

CREATE TABLE public.nouns (
	id varchar(13) NOT NULL,
	singular varchar(128) NOT NULL,
	plural varchar(128) NOT NULL,
	french varchar(128) NOT NULL,
	CONSTRAINT nouns_pkey PRIMARY KEY (id),
	CONSTRAINT nouns_singular_unique UNIQUE (singular)
);

I have an unique constraint on singular. When trying to insert a duplicate value, instead of a database error I could catch, I have the following fatal error:

node:internal/fs/utils:347
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js.map'
    at Object.openSync (node:fs:600:3)
    at Object.readFileSync (node:fs:468:35)
    at Array.retrieveSourceMap (/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/serve/dist/cli.js:50:37)
    at /Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/source-map-support/source-map-support.js:85:24
    at mapSourcePosition (/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/source-map-support/source-map-support.js:216:21)
    at wrapCallSite (/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/source-map-support/source-map-support.js:397:20)
    at Function.prepareStackTrace (/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/source-map-support/source-map-support.js:446:39)
    at maybeOverridePrepareStackTrace (node:internal/errors:140:29)
    at prepareStackTrace (node:internal/errors:114:5)
    at process.emit (/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/source-map-support/source-map-support.js:508:52) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/binajmen/Projects/vocabularium/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js.map'
}

Node.js v18.14.1
{
    "drizzle-orm": "^0.29.3",
    "postgres": "^3.4.3",
}

Using a SQL client leads to the expected error message:

SQL Error [23505]: ERROR: duplicate key value violates unique constraint "nouns_singular_unique"
  Detail: Key (singular)=(das Buch) already exists.
@binajmen
Copy link
Author

binajmen commented Jan 8, 2024

Problem with Remix itself: remix-run/remix#8446

@binajmen binajmen closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant