prisma: Prisma Engine download failure

Discussed in https://github.com/prisma/prisma/discussions/17421

<div type='discussions-op-text'>

Originally posted by salahawk January 19, 2023 I’m now using PostgreSQL with Prisma. I have postgresql@14 running on my machine. And I 've installed prisma in my repo. But when I rum npx prisma db push. it keeps reverting while trying to download Prisma Engine.

Can anyone please help me with this?

image image

</div>

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 33 (10 by maintainers)

Most upvoted comments

Yeah, as for my problem, it has resolved with time without any other involvements. We removed script for downloading prisma engines as well. Preinstall hooks are now working correctly for each build stage after updating prisma to v.4.10.0

Wow, great. thanks guys @crazydevlegend @wwayne @w1ldy0uth Your approaches all helped me resolve my issue.

  • either downloading Prisma engine separately
  • or downgrading Prisma version

Thanks for your support πŸ™‡β€β™‚οΈπŸ™‡β€β™‚οΈπŸ™‡β€β™‚οΈπŸ™‡β€β™‚οΈ

Hey, guys. for me, it was node_module version-related issue. I downgraded Prisma from ^4.9.0 to ^4.5.0 and it works fine. I’m not sure why this happens (maybe not cause of network issue) - I’d love to have the right reason from the development/maintenance team.

The solution offered by @wwayne is the most suitable for this bug. I had the same issue while building Docker container. To solve it, I wrote the script that downloads required engines for my platform and moves it into node_modules.

Download script:

wget https://binaries.prisma.sh/all_commits/ceb5c99003b99c9ee2c1d2e618e359c14aef2ea5/linux-musl/prisma-fmt.gz
gzip -d prisma-fmt.gz
mv prisma-fmt node_modules/@prisma/engines/prisma-fmt-linux-musl

wget https://binaries.prisma.sh/all_commits/ceb5c99003b99c9ee2c1d2e618e359c14aef2ea5/linux-musl/libquery_engine.so.node.gz
gzip -d libquery_engine.so.node.gz
mv libquery_engine.so.node node_modules/@prisma/engines/libquery_engine-linux-musl.so.node

wget https://binaries.prisma.sh/all_commits/ceb5c99003b99c9ee2c1d2e618e359c14aef2ea5/linux-musl/migration-engine.gz
gzip -d migration-engine.gz
mv migration-engine node_modules/@prisma/engines/migration-engine-linux-musl

wget https://binaries.prisma.sh/all_commits/ceb5c99003b99c9ee2c1d2e618e359c14aef2ea5/linux-musl/introspection-engine.gz
gzip -d introspection-engine.gz
mv introspection-engine node_modules/@prisma/engines/introspection-engine-linux-musl

Dockerfile:

FROM node:18.13-alpine3.16

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
USER node

COPY --chown=node:node package*.json ./

ENV DEBUG="prisma,prisma:*"

RUN npm install --verbose --ignore-scripts

COPY --chown=node:node ./ .

RUN chmod 777 prisma-engine-script.sh
RUN ./prisma-engine-script.sh

ENV DATABASE_URL "postgresql://postgres:postgres@postgres:5432/postgres?schema=public"

EXPOSE 80

ENTRYPOINT ["npm", "run", "devStart"]

However, this solution isn’t perfect because I gotta disable all pre/post-install scripts. Moreover, from time to time I get debug message prisma:engines file <engine_name> exists but its version is undefined and we expect ceb5c99003b99c9ee2c1d2e618e359c14aef2ea5.

P.S.: URL’s from script must be selected according to your platform and openssl verison.