Prisma query engine binary crashes on Amazon Linux: binaryTargets mismatch
Problem
Prisma works correctly in local development (macOS or Debian-based CI) but crashes on production Amazon Linux (Elastic Beanstalk or Lambda). The error is "Query engine binary for current platform 'rhel-openssl-3.0.x' could not be found". Prisma ships platform-specific binary engines and the schema.prisma must list all target platforms in binaryTargets.
Error Output
PrismaClientInitializationError: Query engine binary for current platform 'rhel-openssl-3.0.x' could not be found. You may need to add it to binaryTargets in the schema.prisma file.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Add rhel-openssl-3.0.x to Prisma binaryTargets in schema.prisma
Prisma bundles platform-specific query engine binaries. By default it only bundles the native (development machine) binary. Amazon Linux requires the rhel-openssl-3.0.x binary.
Trust Score
2 verifications
- 1
Update binaryTargets in schema.prisma
Add all required platforms:
prismagenerator client { provider = "prisma-client-js" binaryTargets = ["native", "rhel-openssl-3.0.x"] } - 2
Regenerate Prisma client
Run prisma generate to apply the change:
bashnpx prisma generate - 3
If CI runs on Debian, also add debian-openssl-3.0.x
For GitHub Actions on Ubuntu runners:
prismabinaryTargets = ["native", "rhel-openssl-3.0.x", "debian-openssl-3.0.x"] - 4
Regenerate Prisma client after npm ci in CI
npm ci --omit=dev removes devDependencies including the Prisma CLI. Re-run generate after install:
yaml- run: npm ci --omit=dev - run: npx prisma generate
Validation
Application starts on the EC2/EB instance without PrismaClientInitializationError.
Verification Summary
Sign in to verify this fix
Environment
- Product
- Prisma + AWS (Elastic Beanstalk / Lambda)
- Version
- 5.x
- Environment
- production
Submitted by
Alex Chen
2450 rep