Skip to content
Latchkey

Prisma engine download fails (PRISMA_ENGINES_MIRROR / offline) in CI

On first generate Prisma downloads the platform Query Engine from a CDN. On an offline or firewalled runner that request fails, and generation cannot complete without the engine.

What this error means

prisma generate stalls or fails with "Failed to fetch the engine file" or a network timeout to binaries.prisma.sh while downloading the query engine.

Prisma
Error: Failed to fetch the engine file at https://binaries.prisma.sh/all_commits/.../query-engine-debian-openssl-3.0.x.gz
request to https://binaries.prisma.sh/... failed, reason: connect ETIMEDOUT

Common causes

The runner cannot reach the engine CDN

A firewalled or air-gapped CI network blocks binaries.prisma.sh, so the engine cannot be downloaded during generate.

No cached engines across runs

Each job starts clean and re-downloads engines; a transient network failure then fails generation.

How to fix it

Point generation at an internal mirror

Host the engine binaries internally and set the mirror env var so generate fetches from it.

Terminal
export PRISMA_ENGINES_MIRROR=https://npm.internal.example.com/prisma-engines
npx prisma generate

Cache the Prisma engines between runs

Persist the Prisma cache directory so engines are reused instead of re-downloaded each job.

.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: ~/.cache/prisma
    key: prisma-engines-${{ hashFiles('**/schema.prisma') }}

How to prevent it

  • Set PRISMA_ENGINES_MIRROR for offline or firewalled runners.
  • Cache the Prisma engine directory across CI jobs.
  • Allowlist binaries.prisma.sh where a mirror is not available.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →