Sig Bus when using update/upsert with PlanetScale
See original GitHub issueBug description
When trying to update a record using either update
or upsert
the node process crashes with a bus error.
Workaround: update the record using prisma.$execRaw
How to reproduce
- Create a simple model using PlanetScale as the database
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
referentialIntegrity = "prisma"
}
model Counter {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
amount Int
}
- Insert a record using
await prisma.counter.create(...)
- Attempt to update the record using
await prisma.counter.update({ data: { amount: 100 }})
- Watch node crash
Expected behavior
Record should be updated in the database
Prisma information
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
referentialIntegrity = "prisma"
}
model Counter {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
amount Int
}
Environment & setup
- OS: MacOs
- Database: PlanetScale (MySQL)
- Node.js version: v17.2.0
Prisma Version
prisma : 3.6.0
@prisma/client : 3.6.0
Current platform : darwin
Query Engine (Node-API) : libquery-engine dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : dc520b92b1ebb2d28dc3161f9f82e875bd35d727
Studio : 0.440.0
Preview Features : referentialIntegrity
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
PlanetScale quickstart guide
Name your database using lowercase, alphanumeric characters or ... This quickstart demonstrates how to create and use two relational tables: ...
Read more >The PlanetScale workflow
Use the PlanetScale workflow for branching databases, non-blocking schema changes and more.
Read more >Building PlanetScale with PlanetScale
You're probably wondering–if you use MySQL for local development, when do you use PlanetScale? When it comes time to make schema changes, we...
Read more >MySQL compatibility - PlanetScale
If you're importing an existing database, PlanetScale supports MySQL database versions 5.7 through 8.0 . New PlanetScale databases are ...
Read more >Bring your data to PlanetScale
We're happy to announce that PlanetScale now supports zero downtime data migrations from your existing MySQL database.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Working perfectly in 3.7.0 for me. Thanks @janpio
We had the same issue with Planetscale.
Downgrading to
"prisma": "3.5.0"
and"@prisma/client": "3.5.0"
did the job.Not the best answer, but a solution for the short term…