prisma: Generating client to custom location with Next.js is broken
Bug description
Iโm using a custom schema location and custom prisma client location. And itโs failing.
- Schema:
db/schema.prisma
- Client:
db/.generated-prisma-client
(node:1879) UnhandledPromiseRejectionWarning: Error: Query engine binary for current platform "darwin" could not be found.
This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/query-engine-darwin")
Files in /:
.DS_Store
.VolumeIcon.icns
.file
.fseventsd
.vol
Applications
Library
Preboot
System
Users
Volumes
bin
cores
dev
etc
home
opt
private
sbin
tmp
usr
var
You already added the platform "native" to the "generator" block
in the "schema.prisma" file as described in https://pris.ly/d/client-generator,
but something went wrong. That's suboptimal.
Please create an issue at https://github.com/prisma/prisma-client-js/issues/new
How to reproduce
- Check out https://github.com/blitz-js/blitz/pull/124:
git clone -b prisma-gen git@github.com:blitz-js/blitz.git
yarn
yarn build
cd examples/store
- Set your
DATABASE_URL
environment variable for postgres yarn blitz db migrate
yarn blitz start
- Open http://localhost:3000/admin/products
- See error in console.
Expected behavior
Should work
Environment & setup
- OS: macOS
- Database: PostgreSQL
- Prisma version: 2.0.0-alpha.1081"
- Node.js version: 12.6.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 21 (12 by maintainers)
Commits related to this issue
- fix(client): Next.js custom output. Fixes #2195 — committed to prisma/prisma by timsuchanek 4 years ago
- Merge branch 'master' into pr/migrate * master: chore(deps): update studio to v0.318.0 chore(deps): update studio to v0.316.0 fix(deps): update engines to v2.12.0-11.27db1c55cd118b091170f883f58... — committed to prisma/prisma by Jolg42 4 years ago
Just tried it out - I can confirm that this is fixed in the latest version. Let me know if you face any further issues @colinhacks and @flybayer ๐
This will be fixed in https://github.com/vercel/vercel/pull/5455
Perhaps that config could be added to https://github.com/prisma-labs/next-prisma-plugin?
EDIT: This breaks
dev
mode ๐ https://github.com/prisma/prisma/issues/2195#issuecomment-717576013I solved this issue for myself by doing a couple things:
node.__dirname
Webpack setting insidenext.config.js
so itโstrue
in development andfalse
in production..next/serverless
usingcopy-webpack-plugin
This solution was first proposed here.
Related issues: