question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

panicked at 'Could not figure out an ID in create

See original GitHub issue

Bug description

This schema was produced by npx prisma db pull & npx prisma generate This same type of schema works on another table that was generated by npx

image

image

image

thread 'tokio-runtime-worker' panicked at 'Could not figure out an ID in create', query-engine\connectors\sql-query-connector\src\database\operations\write.rs:73:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
PrismaClientUnknownRequestError:
Invalid `prisma.user_clock.create()` invocation:

How to reproduce

Expected behavior

Just insert row into table

Prisma information

model user_role {
  id      Int  @id @unique(map: "iduser_role_UNIQUE") @default(dbgenerated("(concat(`user_id`,`role_id`))"))
  user_id Int
  role_id Int
  role    role @relation(fields: [role_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "role_id")
  user    user @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "user_id")

  @@index([role_id], map: "role_idx")
  @@index([user_id], map: "user_idx")
}

model user_clock {
  id        Int       @id @unique(map: "id_UNIQUE") @default(dbgenerated("(concat(`user_id`,`event_id`))"))
  clock_in  DateTime  @db.DateTime(0)
  clock_out DateTime? @db.DateTime(0)
  user_id   Int
  event_id  Int
  event     event     @relation(fields: [event_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "event_id_clock")
  user      user      @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "user_id_clock")

  @@index([event_id], map: "event_id_clock_idx")
  @@index([user_id], map: "user_id_clock_idx")
}

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

3.0.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ZacharyToneycommented, Sep 16, 2021

Ah got it like slack cool my bad

1reaction
janpiocommented, Sep 16, 2021

I edited your comment so the schema is formatted as code properly. Look at the edit of the comment to learn how I did it @ZacharyToney (triple backtick).

Read more comments on GitHub >

github_iconTop Results From Across the Web

PANIC: Could not figure out an ID in create #5086 - GitHub
Hi Prisma Team! My Prisma Client just crashed. This is the report: Versions Name Version Node v10.16.2 OS windows Prisma Client 2.9.0 Logs ......
Read more >
prisma PANIC:could not figure out an ID in create
Prisma client just crashed with the following error : PANIC : could not figure out an ID in create .
Read more >
Kernel Issues | OpenCore Install Guide - Dortania
For macOS Big Sur, many firmwares have issues determining the CPU core count and thus will kernel panic too early for screen printing....
Read more >
Troubleshoot "Kernel panic" error after upgrading the kernel or ...
I'm receiving a "Kernel panic" error after I've upgraded the kernel or tried to reboot my EC2 Linux instance. How can I fix...
Read more >
What To Do If You Lose Your Driver's License - Driving-Tests.org
Just follow the steps below and you'll be driving again in no time. ... If you can figure out how you lost your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found