prisma: Could not figure out an ID in create

Hi Prisma Team! My Prisma Client just crashed. This is the report:

Versions

Name Version
Node v21.6.0
OS linux-arm64-openssl-3.0.x
Prisma Client 5.12.1
Query Engine 473ed3124229e22d881cb7addf559799debae1ab
Database postgresql

Logs

prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables loaded from /home/sonichigi.linux/bun-sql/.env
prisma:client checkPlatformCaching:postinstall false
prisma:client checkPlatformCaching:ciName 
prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables loaded from /home/sonichigi.linux/bun-sql/.env
prisma:client dirname /home/sonichigi.linux/bun-sql/node_modules/.prisma/client
prisma:client relativePath ../../../prisma
prisma:client cwd /home/sonichigi.linux/bun-sql/prisma
prisma:client clientVersion 5.12.1
prisma:client:libraryEngine internalSetup
prisma:get-platform Found distro info:
{
  "targetDistro": "debian",
  "familyDistro": "debian",
  "originalDistro": "debian"
}
prisma:get-platform Trying platform-specific paths for "debian" (and "ubuntu")
prisma:get-platform Falling back to "ldconfig" and other generic paths
prisma:get-platform Command "ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | grep -v "libssl.so.0"" successfully returned "libssl.so
libssl.so.3
libssl3.so
"
prisma:get-platform Found libssl.so file using "ldconfig" or other generic paths: libssl.so
libssl.so.3
libssl3.so

prisma:get-platform The parsed libssl version is: 3.0.x
prisma:client:engines:resolveEnginePath enginePath /home/sonichigi.linux/bun-sql/node_modules/.prisma/client/libquery_engine-linux-arm64-openssl-3.0.x.so.node
prisma:client:libraryEngine sending request, this.libraryStarted: false
prisma:client:libraryEngine library starting
prisma:client:libraryEngine library started
prisma:client:request_handler {"name":"PrismaClientRustPanicError","clientVersion":"5.12.1"}
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true

Client Snippet

//index.ts
import Elysia from "elysia";
import { recipeController } from "./controllers/post.controller";
import { PrismaClient } from "@prisma/client";
import { userController } from "./controllers/user.controller";
import { commentController } from "./controllers/comments.controller";

//Create instances of prisma and Elysia
const prisma = new PrismaClient();
const app = new Elysia();

//Use controllers as middleware
app.use(userController as any);
app.use(recipeController as any);
app.use(commentController as any);

//Listen for traffic
app.listen(4040, () => {
  console.log("Server is running on port 4040");
});

export { app, prisma };

Schema

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  name      String?
  password  String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
 
  posts  Post[]
  
  comments  Comment[]
}

model Post {
  id        Int      @id @default(autoincrement())
  title     String
  body      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  user      User     @relation(fields: [userId], references: [id])
  userId    Int

  comments  Comment[]
}

model Comment {
  id        Int      @id @default(autoincrement())
  body      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  
  user      User     @relation(fields: [userId], references: [id])
  userId    Int
  
  post   Post  @relation(fields: [postId], references: [id])
  postId Int
}

Prisma Engine Query

{"X":true}}}

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Hey @janpio, so what i observed was that the test case and mock for that specific test are not matched, this is happening due to the fact that the mock and test are based on binary matching while mostly resulted in random mocks for the test cases. Due to this the tests were failing, so when I tried to run keploy test -c "bun --watch index.ts" --removeUnusedMocks , i was able to get actual test result randomly out of 10 times.

I have created a issue :- https://github.com/keploy/keploy/issues/1944

image image

Codespaces seems to work.

  1. make few post api call for creation like signup, create-post

What am I supposed to do in this step of the reproduction though? Can you share some of the calls somehow? curl, Postman, …

  1. stop the docker instance

I assume you mean keploy here - Docker is running the database that is needed for the tests I assume?

Here are few curl commands :-

## Create a User
curl --location 'http://localhost:4040/signup' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name":"Yash",
    "email":"isssalcupnamde@abc.com",
    "password":"1234"
}'

## Login 

curl --location 'http://localhost:4040/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email":"isssalcupnamde@abc.com",
    "password":"1234"
}'

## Create a Post
## You can get <TOKEN> from above curl response

curl --location 'http://localhost:4040/create-post' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "title":"Anime",
    "body":"AOT from quantum"
}'
  1. I mean the database, since I’m using docker to run the postgresdb. After keploy record command and making curl requests, database instance is not required since the mocks are created.

@Sonichigo A few questions:

  1. Can you maybe check if the same problem happens when running your code with Node instead of Bun?
  2. Does this also happen outside the usage of keploy?
  3. Can you add more logging around your Prisma Client queries so that on crash we know which one triggered the crash? Right now it seems we only know that somehow and somewhere when using your app a create query fails with this crash.

Sure, would need sometime, to change to Node and experiment with others.

Hey @Sonichigo,

Would you mind trying with a newer version of Prisma and confirm whether the bug is still present?

Thank you šŸ™