pnpm + prisma + docker
# orm-help
p
pnpm + prisma + docker
@janpio we got a nextjs + prisma app inside an nx monorepo We are using pnpm as our package manager, hence it creates symlinks. We are trying to move it into a docker image but having issues getting the prisma client working. If we build outside of docker, we can't easily copy the generated prisma client as pnpm stores it in an arbitrary location and docker's
COPY
command does not find it if we try and copy from the symlink location (
node_modules/@prisma
) so I tried doing a full on
builder
and
runner
docker image, but when I try to generate the prisma schema inside docker, I get an error in
prisma generate
of unexpected token in JSON unknown char
l
What's up with that? I can see the schema is being read correctly when I do
cat schema.prisma
Using node alpine is that helps and using prisma binary target set to native via env (that I add to the docker image)
j
Definitely worth a bug issue with a reproduction
To guess, I would say that the generation process for some reason can not read some file. Might be the schema, might be another one or even an RPC call or something.
If reproduciton is not easily possible, start by just writing up the setup and the full error message you get exactly when.
p
Any idea where to start looking for other files it might need? does it make db calls during generate command or is it purely reading the schema file?
If you can point me to a good nextjs prisma starter I can try fork it to setup a repro
r
Hi @Pieter - there is an issue with pnpm and prisma but a workaround is to add
output
to the `generator client`:
Copy code
generator client {
  provider = "prisma-client-js"
  output = "../node_modules/.prisma/client"
}
This may help you get a step or 2 further..
p
We actually got output in the generator client already, but I will try the .prisma instead of @prisma to see if that helps
j
There are not database calls during
generate
.
Where the error might come from depends on what you are actually getting - see https://prisma.slack.com/archives/CA491RJH0/p1655119227669859?thread_ts=1655118788.666009&cid=CA491RJH0