prisma: Using 3.12.0, software simply crashes
Bug description
After installing @prisma/client and prisma CLI at version 3.12.0, node simply crashes without any output. the code works when removing:
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
So it’s clearly a Prisma issue, but there is not output to trace it.
prisma generate
works fine without errors.
How to reproduce
- install version 3.12.0
- add prisma client after generating
- crash.
Expected behavior
no crash. code should run.
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model Account {
id Int @id @default(autoincrement()) @db.UnsignedInt
profile_id Int @db.UnsignedInt
name String @default("") @db.VarChar(255)
color String? @default("") @db.VarChar(100)
initialBalance Decimal @default(0.00) @db.Decimal(10, 10)
currency String @default("USD") @db.Char(3)
created_at DateTime? @db.DateTime(0)
updated_at DateTime? @db.DateTime(0)
Transaction Transaction[] @relation("account")
@@map("accounts")
}
model Balance {
id Int @id @default(autoincrement()) @db.UnsignedInt
account_id BigInt @db.UnsignedBigInt
year Int @db.UnsignedInt
balance Decimal @db.Decimal(10, 2)
updated_at DateTime? @db.DateTime(0)
@@map("balances")
}
model Category {
id Int @id @default(autoincrement()) @db.UnsignedInt
profile_id BigInt @db.UnsignedBigInt
name String @default("") @db.VarChar(255)
isBusinessExpense Int @default(0) @db.UnsignedTinyInt
percentageDeductable Decimal @default(0.00) @db.Decimal(10, 2)
created_at DateTime? @db.DateTime(0)
updated_at DateTime? @db.DateTime(0)
Transaction Transaction[] @relation("category")
}
model Project {
id Int @id @default(autoincrement()) @db.UnsignedInt
profile_id Int @db.UnsignedInt
name String @default("") @db.VarChar(255)
created_at DateTime? @db.DateTime(0)
updated_at DateTime? @db.DateTime(0)
@@map("projects")
}
model Subject {
id Int @id @default(autoincrement()) @db.UnsignedInt
profile_id Int @db.UnsignedInt
name String @default("") @db.VarChar(255)
created_at DateTime @db.DateTime(0)
updated_at DateTime @db.DateTime(0)
Transaction Transaction[] @relation("subject")
@@map("subjects")
}
model Transaction {
id Int @id @default(autoincrement()) @db.UnsignedInt
profile_id Int @db.UnsignedInt
account_id Int @db.UnsignedInt
account Account @relation("account", fields: [account_id], references: [id])
category_id Int? @db.UnsignedInt
category Category? @relation("category", fields: [category_id], references: [id])
subject_id Int? @db.UnsignedInt
subject Subject? @relation("subject", fields: [subject_id], references: [id])
date DateTime? @db.Date
amount Int @default(0)
vat Int @default(0)
note String? @db.VarChar(255)
transaction_id Int? @unique @db.UnsignedInt
transfer Transaction? @relation("transfer", fields: [transaction_id], references: [id])
transaction Transaction? @relation("transfer")
is_transfer Int @default(0)
created_at DateTime? @db.DateTime(0)
updated_at DateTime? @db.DateTime(0)
@@map("transactions")
}
model UserProfile {
id Int @id @default(autoincrement()) @db.UnsignedInt
user_id Int @db.UnsignedInt
profile_id Int @db.UnsignedInt
profiles Profile @relation("profilesTouser_profiles", fields: [profile_id], references: [id])
users User @relation("user_profilesTousers", fields: [user_id], references: [id])
@@index([profile_id], name: "fk_profiles")
@@index([user_id], name: "fk_users")
@@map("user_profiles")
}
model User {
id Int @id @default(autoincrement()) @db.UnsignedInt
email String @unique @default("") @db.VarChar(255)
name String? @db.VarChar(255)
password String? @db.VarChar(255)
created_at DateTime @db.DateTime(0)
updated_at DateTime @db.DateTime(0)
user_profiles UserProfile[] @relation("user_profilesTousers")
@@map("users")
}
model Profile {
id Int @id @default(autoincrement()) @db.UnsignedInt
name String @default("") @db.VarChar(255)
created_at DateTime? @db.DateTime(0)
updated_at DateTime? @db.DateTime(0)
user_profiles UserProfile[] @relation("profilesTouser_profiles")
@@map("profiles")
}
Environment & setup
- OS: mac os 12.3
- Database: mysql 8.0.24
- Node.js version: v16.13.2
Prisma Version
as mentioned, 3.12.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Had the same issue, deleting node_modules and reinstalling is what got it working again
Could not reproduce in a new project. After removing node_modules & yarn.lock all issues were solved. Tried downgrading to 3.10 and upgrading to 3.12 again but the error does not occur anymore.
Hi @janpio - Thanks for responding, here’s the answers to your question off the side of my desk, I’ll try and see if I can get a small repro up and running later this afternoon
How do you start your application? For me, this is just in my dev environment so I have a start script that runs
npx tsc
then cd’s into the build folder and runsnode server.js
Does it do anything in idle if no requests come in? No, in my dev environment all batch jobs are turned off, so if the server is running it’s simply waiting for requests
Was it upgraded from a previous Prisma version? Yes
"@prisma/client": "^3.8.1"
I assume you did generate a new prisma client after the upgrade Yes, correct I have a script that runs post install things for me that includes
npx prisma generate --schema ./prisma/EcommSchema.prisma
Am I generating my client to a custom location with
output
Yes, looks like:output = "./generated/EcommSchema"
If I get time tonight, I will create a new project this evening and see if I can reproduce the error
Ok, that would have been my next suggestion as a potential workaround or solution.
For anyone else who has the same problem: Please zip your
node_modules
folder into an archive before trying this! We would really love to be able to compare a before and after of anode_modules
folder where this happens, and deletingnode_modules
turns out to be the solution. This is what could help us identify the problem and hopefully fix it. Thanks.@PatricioNG Based on this information, I think your problem is different from what the other 2 reported and you could optimally create a new bug report with all the information about this that could be useful. Thanks.