prisma: Unable to use dbgenerated uuid_to_bin for ID field: "Could not figure out an ID in create"

Hi Team, I am facing an issue where I am unable to use dbgenerated for mysql8 function uuid_to_bin to associate with my default id . I am getting error as below. I have attached my schema and probably other related details that might be required. Let me know if i am doing this wrong , i did not find anything relevant in documentation that can help.

PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:73:22
Could not figure out an ID in create

This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.

Versions

Name Version
Node v14.16.0
OS rhel-openssl-1.1.x
Prisma Client 2.22.1
Query Engine query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c
Database undefined

Schema

model User {
 
  id      Bytes    @id @db.Binary(16) @default(dbgenerated("(uuid_to_bin(uuid()))"))
  email   String   @unique @db.VarChar(320)
  name    String?
  contact String   @db.VarChar(15)
}

Query

mutation {
  createOneUser(data: {
    name: "X"
    email: "X"
    contact: "X"
  }) {
    id
    email
    name
    contact
  }
}

Logs

  prisma:tryLoadEnv Environment variables loaded from /home/xxx/xxx/prisma-test/.env  
  prisma:tryLoadEnv Environment variables loaded from /home/xxx/xxxt/.env  
  prisma:client clientVersion: 2.22.1  
  prisma:engine { cwd: '/home/xxx/xxx/prisma-test/prisma' }  
  prisma:engine Search for Query Engine in /home/xxx/xxx//prisma-test/node_modules/.prisma/client  
  prisma:engine Search for Query Engine in /home/xxx/xxx//prisma-test/node_modules/.prisma/client  
  plusX Execution permissions of /home/xxx/xxx/prisma-test/node_modules/.prisma/client/query-engine-rhel-openssl-1.1.x are fine  
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '43487' ] }  
  plusX Execution permissions of /home/xxx/xxx//prisma-test/node_modules/.prisma/client/query-engine-rhel-openssl-1.1.x are fine  
  prisma:engin

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@janpio can confirm it works using the dev packages:

"devDependencies": {
  "prisma": "^3.10.0-dev.31"
},
"dependencies": {
  "@prisma/client": "^3.10.0-dev.31"
}