Skip to content

Cannot access engine inside vercel/pkg #8449

@wallkie

Description

@wallkie

Dear community,

I'm having a problem to use prisma inside a vercel/pkg in which i'm getting an ENOENT error like:

spawn /snapshot/enoent-problem/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x ENOENT 

To narrow down the issue i've created a sample application here

To reproduce the issue:

I'm running the packaged app as :

npm i
npx prisma generate
npx pkg package.json --debug --output bin/exe > log-pkg.log
env -i DEBUG_PKG=1 bin/exe

and getting the following error

spawn called cwd: <exec_path>/enoent-problem and dirname: /snapshot/enoent-problem
[Arguments] {
  '0': '/snapshot/enoent-problem/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x',
  '1': [ 'cli', 'get-config' ],
  '2': {
    maxBuffer: 100000000,
    buffer: true,
    stripFinalNewline: true,
    extendEnv: true,
    preferLocal: false,
    localDir: '/snapshot/enoent-problem/node_modules/.prisma/client',
    execPath: '<exec_path>/enoent-problem/bin/exe-node16-linuxstatic',
    encoding: 'utf8',
    reject: true,
    cleanup: true,
    all: false,
    windowsHide: true,
    env: {
      DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/<table_name>?schema=public',
      PRISMA_DML_PATH: '/snapshot/enoent-problem/node_modules/.prisma/client/schema.prisma',
      RUST_BACKTRACE: '1',
      RUST_LOG: 'info',
      LOG_QUERIES: 'true',
      OVERWRITE_DATASOURCES: '[]'
    },
    cwd: '/snapshot/enoent-problem/node_modules/.prisma/client',
    stdio: [ undefined, undefined, undefined ]
  }
}
spawn called cwd: <exec_path>/enoent-problem and dirname: /snapshot/enoent-problem
[Arguments] {
  '0': '/snapshot/enoent-problem/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x',
  '1': [ '--enable-raw-queries', '--port', '33491' ],
  '2': {
    env: {
      DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/<table_name>?schema=public',
      PRISMA_DML_PATH: '/snapshot/enoent-problem/node_modules/.prisma/client/schema.prisma',
      RUST_BACKTRACE: '1',
      RUST_LOG: 'info',
      LOG_QUERIES: 'true',
      OVERWRITE_DATASOURCES: '[]'
    },
    cwd: '/snapshot/enoent-problem/node_modules/.prisma/client',
    windowsHide: true,
    stdio: [ 'ignore', 'pipe', 'pipe' ]
  }
}
prisma:error  in Could not start query engine
spawn /snapshot/enoent-problem/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x ENOENT
Error:  PrismaClientKnownRequestError2 [PrismaClientKnownRequestError]: 
Invalid `prisma.challenge.findMany()` invocation:


  spawn /snapshot/enoent-problem/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x ENOENT
    at cb (/snapshot/enoent-problem/node_modules/@prisma/client/runtime/index.js:34800:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ENOENT',
  clientVersion: '2.27.0',
  meta: undefined
}

I've confirmed that binary has been copied inside the pkg (with pkg --debug) and make sure it's there in virtual fs (with DEBUG_PKG=1 env) but still couldn't figure out the cause of the error. And I can execute the same app without and problem outside pkg with npm start or spawn other binaries inside pkg. I tried so far:

  • To specify PRISMA_QUERY_ENGINE_BINARY outside pkg
  • Different engines and different pkg targets but no dice.

So I'd appreciate if you can help me to figure out what the binary compatibility problem in pkg environment is. Thanks!

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