Skip to content

prisma generate tries to fetch engine checksum files from mirror even if custom engine locations are provided in an .env file #12593

@juzerzarif

Description

@juzerzarif

Bug description

The docs mention that the PRISMA_*_ENGINE_BINARY variables can be added via an env file - https://www.prisma.io/docs/concepts/components/prisma-engines#a-the-env-file

When running prisma generate it seems that prisma tries to fetch binaries before loading any environment variables from an .env file (.env or prisma/.env). If you're behind a firewall that doesn't allow access to https://binaries.prisma.sh then the generation fails right at that step even if there are custom locations for binaries in the env variables in an .env file.

If you load the env variables into the shell environment before running prisma generate that will preempt the fetching of binaries from a mirror however.

For our use case, it's often more convenient (and sometimes really the only option) to provide shared non-secret env variables via a .env file checked into source control rather than define them on the CI box itself. So if prisma CLI could load env variables before attempting the download of binaries that would solve this issue. I'm willing to contribute if someone could point me to where this functionality lives!

How to reproduce

  1. Block access to https://binaries.prisma.sh (make sure there's no cache in ~/.cache/prisma or the corresponding cache location for your os)
  2. Perform a fresh npm install of prisma and @prisma/client
  3. Run npx prisma generate should fail with a network error trying to access https://binaries.prisma.sh

Expected behavior

prisma generate (or any other prisma commands for that matter) should read the engine binary location from the env variables in the .env file instead of trying to download them from the mirror.

Prisma information

N/A

Environment & setup

  • OS: Mac OS
  • Database: N/A
  • Node.js version: 16.14.0

Prisma Version

prisma                  : 3.10.0
@prisma/client          : 3.10.0
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine    : introspection-core 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary           : prisma-fmt 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Default Engines Hash    : 73e60b76d394f8d37d8ebd1f8918c79029f0db86
Studio                  : 0.458.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions