Skip to content

PRISMA_ENGINES_MIRROR and BINARY_DOWNLOAD_VERSION env variables don't work when npm install #25433

@dengfuping

Description

@dengfuping

Bug description

How to reproduce

  • set env variables in .env:
PRISMA_ENGINES_MIRROR="https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com"
BINARY_DOWNLOAD_VERSION="96fa66f2f130d66795d9f79dd431c678a9c7104e"
  • reinstall deps and view log rm -rf node_modules && DEBUG="prisma:*" npm i --foreground-scripts:
> prisma@5.20.0 preinstall
> node scripts/preinstall-entry.js


> @prisma/client@5.20.0 postinstall
> node scripts/postinstall.js

prisma:engines binaries to download libquery-engine, schema-engine +869ms
prisma:fetch-engine:download file xxx/node_modules/@prisma/engines/schema-engine-darwin does not exist and must be downloaded +7ms
prisma:fetch-engine:download file xxx/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node does not exist and must be downloaded +0ms
prisma:fetch-engine:download https://binaries.prisma.sh/all_commits/06fc58a368dc7be9fbbbe894adf8d445d208c284/darwin/libquery_engine.dylib.node.gz will be downloaded to xxx/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node +2ms
prisma:fetch-engine:download https://binaries.prisma.sh/all_commits/06fc58a368dc7be9fbbbe894adf8d445d208c284/darwin/schema-engine.gz will be downloaded to xxx/node_modules/@prisma/engines/schema-engine-darwin +0ms
prisma:fetch-engine:download Downloading https://binaries.prisma.sh/all_commits/06fc58a368dc7be9fbbbe894adf8d445d208c284/darwin/libquery_engine.dylib.node.gz to xxx/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node ... +1ms
> Downloading Prisma engines for Node-API for darwin [                    ] 0%prisma:fetch-engine:download Downloading https://binaries.prisma.sh/all_commits/06fc58a368dc7be9fbbbe894adf8d445d208c284/darwin/schema-engine.gz to xxx/node_modules/@prisma/engines/schema-engine-darwin ... +90ms
prisma:loadEnv project root found at xxx/package.json +5826ms
prisma:getSchema prismaConfig {
  "packagePath": "xxx/package.json"
} +2ms
prisma:tryLoadEnv Environment variables loaded from xxx/.env +0ms
Environment variables loaded from .env
prisma:getSchema prismaConfig {
  "packagePath": "xxx/package.json"
} +5ms
prisma:getSchema Checking existence of xxx/schema.prisma +1ms
prisma:getSchema Reading schema from single file xxx/schema.prisma +0ms
prisma:getSchema Checking existence of xxx/prisma/schema.prisma +0ms
prisma:getSchema Reading schema from single file xxx/prisma/schema.prisma +0ms
prisma:getSchema Reading schema from multiple files xxx/prisma/schema +3ms
Prisma schema loaded from prisma/schema.prisma
prisma:getConfig Using getConfig Wasm +2ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +19ms
prisma:getSchema Reading schema from single file xxx/prisma/schema.prisma +2ms
prisma:fetch-engine:download process.env.BINARY_DOWNLOAD_VERSION is set to "96fa66f2f130d66795d9f79dd431c678a9c7104e" +1ms
prisma:fetch-engine:download file xxx/node_modules/prisma/libquery_engine-darwin.dylib.node does not exist and must be downloaded +2ms
prisma:fetch-engine:download https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com/all_commits/96fa66f2f130d66795d9f79dd431c678a9c7104e/darwin/libquery_engine.dylib.node.gz will be downloaded to xxx/node_modules/prisma/libquery_engine-darwin.dylib.node +3ms
prisma:fetch-engine:download Downloading https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com/all_commits/96fa66f2f130d66795d9f79dd431c678a9c7104e/darwin/libquery_engine.dylib.node.gz to xxx/node_modules/prisma/libquery_engine-darwin.dylib.node ... +1ms
prisma:getConfig Using getConfig Wasm +34143ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +1ms
prisma:getDMMF Using getDmmf Wasm +0ms
prisma:getDMMF Using given datamodel +1ms
prisma:getDMMF dmmf data retrieved without errors in getDmmf Wasm +32ms
prisma:generator prismaCLIDir xxx/node_modules/prisma +6ms
prisma:generator prismaClientDir xxx/node_modules/@prisma/client +0ms
prisma:generator baseDir xxx/prisma +0ms
prisma:generator typescriptPath xxx/node_modules/typescript +3ms
prisma:GeneratorProcess prisma:client:generator requiredEngine: libqueryEngine +26ms +138ms
prisma:mergeSchemas Using mergeSchemas Wasm +1ms
prisma:loadEnv project root found at xxx/node_modules/@prisma/client/package.json +3ms
prisma:getSchema prismaConfig {
  "packagePath": "xxx/package.json"
} +2ms
prisma:getGenerators neededVersions {
  "06fc58a368dc7be9fbbbe894adf8d445d208c284": {
    "engines": [
      "libqueryEngine"
    ],
    "binaryTargets": [
      {
        "fromEnvVar": null,
        "value": "darwin",
        "native": true
      }
    ]
  }
} +1ms
prisma:fetch-engine:download process.env.BINARY_DOWNLOAD_VERSION is set to "96fa66f2f130d66795d9f79dd431c678a9c7104e" +0ms
prisma:getGenerators {
  "generatorBinaryPaths": {
    "libqueryEngine": {
      "darwin": "xxx/node_modules/prisma/libquery_engine-darwin.dylib.node"
    }
  }
} +110ms
prisma:tryLoadEnv Environment variables not found at null +8ms
prisma:tryLoadEnv Environment variables loaded from xxx/.env +0ms
prisma:cli:bin Execution time for executing "await cli.parse(commandArray)": 39551.220044 ms +116ms

✔ Generated Prisma Client (v5.20.0) to ./node_modules/@prisma/client in 93ms

Start by importing your Prisma Client (See: http://pris.ly/d/importing-client)

Tip: Easily identify and fix slow SQL queries in your app. Optimize helps you enhance your visibility: https://pris.ly/--optimize

prisma:GeneratorProcess child exited with code null on signal SIGTERM +5ms
prisma:getSchema prismaConfig {
  "packagePath": "xxx/package.json"
} +1ms
prisma:getSchema Checking existence of xxx/schema.prisma +0ms
prisma:getSchema Reading schema from single file xxx/schema.prisma +0ms
prisma:getSchema prismaConfig {
  "packagePath": "xxx/package.json"
} +0ms
prisma:getSchema Checking existence of xxx/schema.prisma +0ms
prisma:getSchema Reading schema from single file xxx/schema.prisma +0ms
prisma:getSchema Checking existence of xxx/prisma/schema.prisma +0ms
prisma:getSchema Reading schema from single file xxx/prisma/schema.prisma +0ms
prisma:getSchema Checking existence of xxx/prisma/schema.prisma +1ms
prisma:getSchema Reading schema from single file xxx/prisma/schema.prisma +0ms
prisma:getSchema Reading schema from multiple files xxx/prisma/schema +1ms
prisma:getSchema Reading schema from multiple files xxx/prisma/schema +0ms
prisma:getConfig Using getConfig Wasm +0ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +1ms
prisma:cli:checkpoint runCheckpointClientCheck(): Execution time for getting info: 8.311571000005642 ms +0ms
prisma:cli:checkpoint runCheckpointClientCheck(): Execution time for "await checkpoint.check(data)": 32.38349900000321 ms +33ms

> @prisma/engines@5.20.0 postinstall
> node scripts/postinstall.js


added 28 packages in 44s

Expected behavior

Self-hosted binary url: https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com/all_commits/96fa66f2f130d66795d9f79dd431c678a9c7104e/darwin/libquery_engine.dylib.node.gz

  • Prisma binary download url should be https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com instead of https://binaries.prisma.sh.
  • Prisma binary download version should be 96fa66f2f130d66795d9f79dd431c678a9c7104e instead of 06fc58a368dc7be9fbbbe894adf8d445d208c284.

Prisma information

  • npx prisma debug can load correct env:
...
For downloading engines
- PRISMA_ENGINES_MIRROR: `https://oceanbase-prisma-builds.s3.ap-southeast-1.amazonaws.com`
- PRISMA_BINARIES_MIRROR (deprecated):
- PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING:
- BINARY_DOWNLOAD_VERSION: `96fa66f2f130d66795d9f79dd431c678a9c7104e`
...

Environment & setup

  • OS: macOS
  • Database: MySQL
  • Node.js version: v21.6.2

Prisma Version

- prisma: 5.20.0
- @prisma/client: 5.20.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: engine download

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions