Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[legacy-framework] Generate prisma client into project instead of node_modules #124

Closed
wants to merge 3 commits into from

Conversation

flybayer
Copy link
Member

@flybayer flybayer commented Apr 15, 2020

It turns out that generating prisma client into node_modules/@prisma/client is flaky in that it often get's blown away when installing or updating dependencies.

So Blitz apps will generate it into the project, but in a hidden folder: db/.generated-prisma-client

Currently not working because of a prisma bug

  • Get prisma actually working
  • Update new app template

@flybayer
Copy link
Member Author

So the main issue here is __dirname not working right with Next.js.

  • Maybe the different is the client is getting transpiled now since not in node_modules?
  • Can we fix this with webpack?
  • Could swap out __dirname in our server transform with a hard coded value, but only for development?
  • Need to see if it's only broken in dev, but not production

@flybayer
Copy link
Member Author

Update: I got it working!

@flybayer flybayer removed the status/blocked Waiting on something else label Apr 18, 2020
@flybayer
Copy link
Member Author

Actually not...

@flybayer flybayer added the status/blocked Waiting on something else label Apr 18, 2020
@flybayer
Copy link
Member Author

Well, I'm giving up on this for now.

@sijad
Copy link

sijad commented Apr 18, 2020

can I take a look? if yes, let me know how can I reproduce it please

@flybayer
Copy link
Member Author

@sijad you sure can!!

Steps to reproduce are here: prisma/prisma#2195

@flybayer
Copy link
Member Author

So this branch as of right now does work properly on the local machine with blitz start and blitz start --production.

But it is still failing a production deployment to Zeit with:

Invalid `prisma.product.findMany()` invocation:
Query engine binary for current platform "rhel-openssl-1.0.x" could not be found.
This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/zeit/59caaf16/.blitz/caches/build/db/.generated-prisma-client/runtime/query-engine-rhel-openssl-1.0.x")
Files in /zeit/59caaf16/.blitz/caches/build/db/.generated-prisma-client/runtime:

Not sure how to fix this. Might be as easy as copying moving some files around.

@sijad
Copy link

sijad commented Apr 18, 2020

this can be related to vercel/vercel#2824

@flybayer
Copy link
Member Author

No it's only related to our build step and how we are moving files around. That error shows that there are no files where it's looking. If it was a native binary issue, the wrong binary would show there

@sijad
Copy link

sijad commented Apr 18, 2020

is it possible to download possible binaries using @prisma/fetch-engine and include all of them in production?

@flybayer
Copy link
Member Author

@sijad so the issue is that there are no binaries. Not that it has the wrong binaries.

The webpack plugin added in this PR substitutes __dirname for what it is at build time. And at build time the files are in .blitz. But the actual build output for Zeit is in .next. So we might need to change the webpack plugin to use the .next path instead.

But in any case, this is low priority right now, so I'm not too worried about it.

@flybayer flybayer closed this Nov 11, 2020
@flybayer flybayer deleted the prisma-gen branch November 13, 2020 00:22
@dillondotzip dillondotzip changed the title Generate prisma client into project instead of node_modules [legacy-framework] Generate prisma client into project instead of node_modules Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/blocked Waiting on something else
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants