Segmentation fault crash when using prisma client when using PostgreSQL
See original GitHub issueBug description
When trying to use findMany()
(or any other method) on a model, prisma client crashes and the following line appears in my log:
Segmentation fault (core dumped)
.
This only happens if I use PostgreSQL as far as I know, this first appeared when I switched to PostgreSQL from mysql.
How to reproduce
- Initiate a new prisma project (make sure to use PostgreSQL) and generate the client - no errors there
- Write a simple client which fetches some data from the databse
- The script crashes and
Segmentation fault (core dumped)
gets logged in the console
Expected behavior
The script does not crash.
Prisma information
Example schema:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id
email String?
}
Example test client:
const {PrismaClient} = require('@prisma/client');
const prisma = new PrismaClient({ log: ['query', 'info', 'warn'] })
prisma.user.findMany().then((e) => {
console.log(e)
})
Environment & setup
- OS: Pop!_OS (
Linux pop-os 5.15.5-76051505-generic #202111250933~1638201579~21.04~09f1aa7-Ubuntu SMP Tue Nov 30 02: x86_64 x86_64 x86_64 GNU/Linux
) - Database: PostgreSQL v14.1 (Ubuntu 14.1-1.pgdg21.04+1)
- Node.js version: v17.2.0
Prisma Version
prisma : 3.6.0
@prisma/client : 3.6.0
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : dc520b92b1ebb2d28dc3161f9f82e875bd35d727
Studio : 0.440.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:17
- Comments:50 (20 by maintainers)
Top Results From Across the Web
Node application crashes on prisma request (segmentation ...
Prisma is connecting to my own Postgres database outside of fly.io (it's a supabase postgres instance), not sure if that is relevant at...
Read more >Segmentation fault on postgresql 13.4, 12.8 with function call ...
Hi,. a recent change in postgresql is causing a segfault when a function is called in filter section, e.g. with a plan like...
Read more >Troubleshooting database outages and connection issues
Learn about the possible reasons your database might be down or not connected and what you can do to fix it.
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
systemPrefs with at least two files" status:RESOLVED resolution:OBSOLETE severity:normal ... Bug:79320 - "xfwm4 4.2.0 random segfault" status:RESOLVED ...
Read more >Pulse · prisma/prisma · GitHub
Segmentation fault crash when using prisma client when using PostgreSQL. #10649 commented on Sep 8, 2022 • 2 new comments. Cursor based pagination...
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
While we are looking for the best way to fix or prevent the underlying problem, the recommended workaround for affected users is to make sure that the versions of OpenSSL used by Node.js and the system OpenSSL match:
If your distribution provides a build of Node.js 18 with OpenSSL 1.1.1, you can use that instead of the upstream Node.js build that vendors OpenSSL 3. This is the case on Alpine, where you can install
nodejs-current
from repositorycommunity
: it provides (at the moment of writing) Node.js 18.6.0 linked with OpenSSL 1.1.1q, and the issue is not reproducible when using it.Alternatively, if you can’t do any of that and you need to stay with the upstream build of Node.js 18 on a system with OpenSSL 1.1.x, you can switch to the binary engine in Prisma.
Add the same issue running on latest node version 17.4.0. Fixed by using the current LTS 16.3.2.