Apify

Apify and Crawlee Official Forum

b
F
A
J
A

Crash on using Prisma, generate and schema

My Actor saves data using Prisma client. But when I run the actor, Crawler says is needed to run prisma generate, although I generated after the build.

Any tips on how to solve it? The files are all in /myuser/ folder.

my package.json: https://pastebin.com/KqMYk7Ae
Apify build log: https://pastebin.com/71LrxCWN
Apify run log: https://pastebin.com/fg2dUW0C
d
o
2 comments
Can anyone help with this? @Lukas Celnar @Saurav Jain
Hey,

we use multistage docker image builds to build our actors. TLDR: files generated by prisma generate do not end up in the final actor's image, that's being run.

Solution should be simple - you just need to copy the files generated by prisma generate to the final image. According to prisma docs, generated files are stored in node_modules/.prisma/client, so you should just copy them same way as dist folder:
Plain Text
COPY --from=builder --chown=myuser /home/myuser/dist ./dist

# Copying files from `prisma generate` to the final image
COPY --from=builder --chown=myuser /home/myuser/node_modules/.prisma/client ./node_modules/.prisma/client # <<< add this line to your dockerfile


Let me know if this helped
Add a reply
Sign up and join the conversation on Discord
Join