Prisma "prisma generate" Engine Download Failed in CI
Prisma Client generation downloads a query-engine binary at build time. The download from the Prisma binaries CDN did not complete - a connectivity, proxy, or CDN-slowness problem, not a schema issue.
What this error means
prisma generate (or postinstall) fails while fetching the engine, reporting a download/timeout error against binaries.prisma.sh. It frequently succeeds on retry once the network or CDN recovers.
Error: Failed to fetch the engine file at
https://binaries.prisma.sh/.../libquery_engine-debian-openssl-3.0.x.so.node.gz
request to ... failed, reason: connect ETIMEDOUTCommon causes
Transient network blip to the binaries CDN
A brief connectivity drop or slow CDN response makes the engine download exceed its timeout. Nothing is wrong with your schema - the fetch just did not finish.
Proxy or firewall blocking binaries.prisma.sh
A locked-down runner may not be allowed to reach the Prisma CDN, so every download attempt fails until the host is allow-listed or a mirror is configured.
No engine cache between runs
Without caching, every CI run re-downloads the engine, multiplying the chance of hitting a flaky network.
How to fix it
Retry generation for a transient failure
Because the download is usually transient, a bounded retry clears it with no change.
for i in 1 2 3; do
npx prisma generate && break
echo "engine download retry $i"; sleep 5
doneCache the Prisma engines and node_modules
Caching avoids re-downloading the engine each run, so a flaky CDN matters far less.
- uses: actions/cache@v4
with:
path: |
node_modules/.prisma
~/.cache/prisma
key: prisma-${{ hashFiles('prisma/schema.prisma') }}Allow the CDN or use a mirror
- Allow-list
binaries.prisma.shthrough the proxy/firewall on the runner. - For locked-down networks, set
PRISMA_ENGINES_MIRRORto an internal mirror of the binaries. - Confirm the generated
binaryTargetsmatch the runtime so only needed engines download.
How to prevent it
- Cache the Prisma engine directory keyed on the schema.
- Allow
binaries.prisma.sh(or setPRISMA_ENGINES_MIRROR) on restricted runners. - Pin the Prisma version so the engine set is stable and cacheable.