Write operations consistently fail with a weird error.
Full debug output
prisma-client {
prisma-client engineConfig: {
prisma-client cwd: '/dir/project',
prisma-client debug: false,
prisma-client datamodelPath: '/dir/project/node_modules/@prisma/client/schema.prisma',
prisma-client prismaPath: undefined,
prisma-client datasources: [],
prisma-client generator: {
prisma-client name: 'client',
prisma-client provider: 'prisma-client-js',
prisma-client output: '/dir/project/node_modules/@prisma/client',
prisma-client binaryTargets: [Array],
prisma-client config: {}
prisma-client },
prisma-client showColors: false,
prisma-client logLevel: 'info',
prisma-client logQueries: true,
prisma-client env: {
prisma-client POSTGRES_URI: 'postgres://username:password@hostname:port/db'
prisma-client },
prisma-client flags: []
prisma-client }
prisma-client } +0ms
getos { version: 'OpenSSL 1.1.1 11 Sep 2018\n' } +0ms
getos { ls: '' } +1ms
getos { platform: 'linux', libssl: '1.1.x' } +3ms
engine {
engine PRISMA_DML_PATH: '/dir/project/node_modules/@prisma/client/schema.prisma',
engine PORT: '51724',
engine RUST_BACKTRACE: '1',
engine RUST_LOG: 'info',
engine LOG_QUERIES: 'true',
engine OVERWRITE_DATASOURCES: '[]'
engine } +0ms
engine { cwd: '/dir/project' } +3ms
plusX Execution permissions of /dir/project/node_modules/@prisma/client/runtime/query-engine-debian-openssl-1.1.x are fine +0ms
engine { flags: [ '--enable-raw-queries' ] } +1ms
engine stderr Printing to stderr for debugging +48ms
engine stderr Listening on 127.0.0.1:51724 +1ms
engine stdout {
timestamp: 'Apr 08 02:57:54.453',
level: 'INFO',
target: 'quaint::pooled',
fields: { message: 'Starting a postgresql pool with 5 connections.' }
} +1ms
prisma:info Starting a postgresql pool with 5 connections.
engine stdout {
timestamp: 'Apr 08 02:57:54.460',
level: 'INFO',
target: 'prisma::server',
fields: {
message: 'Started http server on 127.0.0.1:51724',
'log.target': 'prisma::server',
'log.module_path': 'prisma::server',
'log.file': 'query-engine/prisma/src/server.rs',
'log.line': 109
}
} +6ms
prisma:info Started http server on 127.0.0.1:51724
prisma-client Prisma Client call: +973ms
prisma-client prisma.guild.create({
prisma-client data: {
prisma-client id: 'id',
prisma-client notifications: {
prisma-client create: {
prisma-client id: 'banUnban',
prisma-client channels: {
prisma-client set: [
prisma-client 'channel id'
prisma-client ]
prisma-client }
prisma-client }
prisma-client },
prisma-client prefix: 'prefix',
prisma-client selfRoles: {
prisma-client set: [
prisma-client 'role id'
prisma-client ]
prisma-client },
prisma-client tags: {
prisma-client create: [
prisma-client {
prisma-client author: 'author',
prisma-client content: 'content',
prisma-client id: 'id'
prisma-client }
prisma-client ]
prisma-client }
prisma-client }
prisma-client }) +2ms
prisma-client Generated request: +5ms
prisma-client mutation {
prisma-client createOneGuild(data: {
prisma-client id: "id"
prisma-client notifications: {
prisma-client create: [
prisma-client {
prisma-client id: "banUnban"
prisma-client channels: {
prisma-client set: ["channel id"]
prisma-client }
prisma-client }
prisma-client ]
prisma-client }
prisma-client prefix: "prefix"
prisma-client selfRoles: {
prisma-client set: ["role id"]
prisma-client }
prisma-client tags: {
prisma-client create: [
prisma-client {
prisma-client author: "author"
prisma-client content: "content"
prisma-client id: "id"
prisma-client }
prisma-client ]
prisma-client }
prisma-client }) {
prisma-client id
prisma-client prefix
prisma-client selfRoles
prisma-client }
prisma-client }
prisma-client +0ms
engine stdout {
timestamp: 'Apr 08 02:57:55.002',
level: 'INFO',
target: 'quaint::connector::metrics',
fields: { query: 'BEGIN', item_type: 'query', params: '[]', duration_ms: 76 }
} +542ms
prisma:query BEGIN
engine stdout {
timestamp: 'Apr 08 02:57:55.153',
level: 'INFO',
target: 'quaint::connector::metrics',
fields: {
query: 'INSERT INTO "public"."Guild" ("id","prefix","selfRoles") VALUES ($1,$2,$3) RETURNING "public"."Guild"."id"',
item_type: 'query',
params: '["id","prefix",["role id"]]',
duration_ms: 150
}
} +151ms
prisma:query INSERT INTO "public"."Guild" ("id","prefix","selfRoles") VALUES ($1,$2,$3) RETURNING "public"."Guild"."id"
engine stdout {
timestamp: 'Apr 08 02:57:55.229',
level: 'INFO',
target: 'quaint::connector::metrics',
fields: {
query: 'ROLLBACK',
item_type: 'query',
params: '[]',
duration_ms: 74
}
} +76ms
prisma:query ROLLBACK
engine {
engine error: PrismaClientUnknownRequestError: Error occurred during query execution:
engine InterpretationError("Error for binding \'0\': DomainError(ConversionFailure(\"record identifier\", \"assimilated record identifier\"))")
engine at NodeEngine.graphQLToJSError (/dir/project/node_modules/@prisma/client/runtime/index.js:1:18851)
engine at /dir/project/node_modules/@prisma/client/runtime/index.js:1:16338
engine at processTicksAndRejections (internal/process/task_queues.js:97:5)
engine at Dataloader.loader (/dir/project/node_modules/@prisma/client/runtime/index.js:1:50647)
engine } +9ms
printStack callsite Error
at Object.s [as Guild] (/dir/project/node_modules/@prisma/client/runtime/index.js:1:48551)
at Object.n. [as create] (/dir/project/node_modules/@prisma/client/runtime/index.js:1:50177)
at migrate (/dir/project/src/the_big_migration.ts:74:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5) +0ms
PrismaClientUnknownRequestError:
Invalid `prisma.guild.create()` invocation in
/dir/project/src/the_big_migration.ts:74:21
70
71 export async function migrate(): Promise {
72 await mongo.connect();
73 await prisma.connect();
→ 74 await prisma.guild.create(
Error occurred during query execution:
InterpretationError("Error for binding \'0\': DomainError(ConversionFailure(\"record identifier\", \"assimilated record identifier\"))")
at PrismaClientFetcher.request (/dir/project/node_modules/@prisma/client/runtime/index.js:1:51485)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Not entirely sure, but it happens every time I attempt a create operation.
The write operation succeeds and my app becomes world famous.
datasource sqlite {
url = env("POSTGRES_URI")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
model User {
id String @id
balance Float @default(1000)
dailyUsed DateTime?
blacklistReason String?
}
model Guild {
id String @id
prefix String?
selfRoles String[]
tags Tag[]
notifications NotificationSettings[]
}
model Tag {
id String @id
content String
author String
}
model NotificationSettings {
id String @id
channels String[]
}
await prisma.guild.create({
data: {
id: 'id',
notifications: {create: {id: 'banUnban' as Notification, channels: {set: ['channel id']}}},
prefix: 'prefix',
selfRoles: {set: ['role id']},
tags: {create: [{author: 'author', content: 'content', id: 'id'}]}
}
});
@prisma/cli : 2.0.0-beta.1
Current platform : debian-openssl-1.1.x
Query Engine : prisma 2accb9c7eacdc984874eaeb63377fe705dfd3203 (at /dir/project/node_modules/@prisma/cli/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli 2accb9c7eacdc984874eaeb63377fe705dfd3203 (at /dir/project/node_modules/@prisma/cli/migration-engine-debian
-openssl-1.1.x)
Introspection Engine : introspection-core 2accb9c7eacdc984874eaeb63377fe705dfd3203 (at /dir/project/node_modules/@prisma/cli/introspection-engine-debian-openssl-1.1.x)
v12.16.1I am seeing similar errors. For example:
Query interpretation error. Error for binding '7': DomainError(ConversionFailure("record identifier", "assimilated record identifier"))
at PrismaClientFetcher.request (/Users/alex/projects/alexthegoodman/reeviewr-prisma/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:644:17)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: 'P2016',
meta:
{ details:
'Error for binding \'7\': DomainError(ConversionFailure("record identifier", "assimilated record identifier"))' } }
Prisma Versions:
@prisma/cli : 2.0.0-beta.2
Current platform : darwin
Query Engine : query-engine 76857c35ba1e1764dd5473656ecbbb2f739e1822 (at /Users/alex/.config/yarn/global/node_modules/@prisma/cli/query-engine-darwin)
Migration Engine : migration-engine-cli 76857c35ba1e1764dd5473656ecbbb2f739e1822 (at /Users/alex/.config/yarn/global/node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 76857c35ba1e1764dd5473656ecbbb2f739e1822 (at /Users/alex/.config/yarn/global/node_modules/@prisma/cli/introspection-engine-darwin)
Let me know if I can be of any help.
@alexthegoodman if you enabled the debug logging of the Prisma query engine and the client library we would have more information of what caused the error.
Can you both try again with beta.2? That might give better error messages.
I updated to Prisma 2.0.0-beta.2 and am having an error occur, although it has significantly different output than the original one.
Schema is the same as before (although, the VSCode format document command wanted to add in some new fields)
Full debug output
prisma:info Starting a postgresql pool with 5 connections.
prisma:info Started http server on 127.0.0.1:62158
prisma:query BEGIN
prisma:query INSERT INTO "public"."Guild" ("id","prefix","selfRoles") VALUES ($1,$2,$3) RETURNING "public"."Guild"."id"
prisma:query INSERT INTO "public"."NotificationSettings" ("id","channels","guildId") VALUES ($1,$2,$3) RETURNING "public"."NotificationSettings"."id"
prisma:query ROLLBACK
PrismaClientUnknownRequestError:
Invalid `prisma.guild.create()` invocation in
/dir/project/src/the_big_migration.ts:74:21
70
71 export async function migrate(): Promise<ExitCodes | undefined> {
72 await mongo.connect();
73 await prisma.connect();
→ 74 await prisma.guild.create(
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("42703")
, message: "column \"guildId\" of relation \"NotificationSettings\" does not exist", detail: None, hint: None, position: Some(Original(62)), where_: None, schema: None, table: None, colu
mn: None, datatype: None, constraint: None, file: Some("parse_target.c"), line: Some(1029), routine: Some("checkInsertTargets") }) }) })
at PrismaClientFetcher.request (/dir/project/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:651:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Prisma version:
@prisma/cli : 2.0.0-beta.2
Current platform : debian-openssl-1.1.x
Query Engine : query-engine 76857c35ba1e1764dd5473656ecbbb2f739e1822 (at /dir/project/node_modules/@prisma/cli/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli 76857c35ba1e1764dd5473656ecbbb2f739e1822 (at /dir/project/node_modules/@prisma/cli/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 76857c35ba1e1764dd5473656ecbbb2f739e1822 (at /dir/project/node_modules/@prisma/cli/introspection-engine-debian-openssl-1.1.x)
You will probably need to update your schema according to https://github.com/prisma/prisma/releases/tag/2.0.0-beta.1
Upgrading to beta.2, updating my schema, and running prisma migrate up fixed the issue.
I didn't notice it, but inside the most recent stacktrace I posted there is a SQL error about a missing column. This is because the schema had changed internally (since hadn't migrated from preview -> beta schema) and the DB was missing a column.
Most helpful comment
Upgrading to
beta.2, updating my schema, and runningprisma migrate upfixed the issue.I didn't notice it, but inside the most recent stacktrace I posted there is a SQL error about a missing column. This is because the schema had changed internally (since hadn't migrated from preview -> beta schema) and the DB was missing a column.