Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown error in SQLite Connector migrating from Prisma 3.x to 4.0.0 on ARM/M1 machines #14057

Closed
TasinIshmam opened this issue Jun 29, 2022 · 5 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: macos
Milestone

Comments

@TasinIshmam
Copy link

TasinIshmam commented Jun 29, 2022

Bug description

Migrating an SQLite project from Prisma 3. x to 4.00 results in an unknown error, causing the node process to terminate, without throwing any exceptions.

The error occurs whenever one tries to run any operation on the SQLite database through Prisma. Note that it only seems to affect M1 machines. I could not reproduce the bug on a Ubuntu 18.04 machine.

How to reproduce

  1. Clone this repo: https://github.com/TasinIshmam/prisma-sqlite-bug-v4
  2. Follow instructions in README.md

Expected behavior

Prisma should work as expected after migrating to v4 without any issues.

Actual Behavior:

An unknown issue terminates the node process, without any stack trace or bugs.

Logs in debug mode:

~/my-code/code-and-projects/work/remix/prisma-sqlite (main*) » npx ts-node index.ts                   
  prisma:tryLoadEnv  Environment variables loaded from /Users/tasinishmam/my-code/code-and-projects/work/remix/prisma-sqlite/.env +0ms
  prisma:tryLoadEnv  Environment variables loaded from /Users/tasinishmam/my-code/code-and-projects/work/remix/prisma-sqlite/.env +2ms
  prisma:client  dirname /Users/tasinishmam/my-code/code-and-projects/work/remix/prisma-sqlite/node_modules/.prisma/client +0ms
  prisma:client  relativePath ../../../prisma +0ms
  prisma:client  cwd /Users/tasinishmam/my-code/code-and-projects/work/remix/prisma-sqlite/prisma +0ms
  prisma:client  clientVersion: 4.0.0 +0ms
  prisma:client  clientEngineType: library +0ms
  prisma:client:libraryEngine  internalSetup +0ms
  prisma:client:libraryEngine:loader  Searching for Query Engine Library in /Users/tasinishmam/my-code/code-and-projects/work/remix/prisma-sqlite/node_modules/.prisma/client +0ms
  prisma:client:libraryEngine:loader  loadEngine using /Users/tasinishmam/my-code/code-and-projects/work/remix/prisma-sqlite/node_modules/.prisma/client/libquery_engine-darwin-arm64.dylib.node +0ms
[2]    45503 killed     npx ts-node index.ts

Workaround:

Clearing the node_modules folder before installing prisma version 4.0.0 resolves the problem. So one can use the following command to fix the problem: rm -rf node_modules && npm i.

Prisma information

Prisma Schema and client information are available in the reproduction repo.

Environment & setup

  • OS: MacOS Monterey 12.4 (M1 Pro)
  • Database: SQLite
  • Node.js version: 16.14.2

Prisma Version

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

Internal

https://prisma-company.slack.com/archives/C02FZENHD4N/p1656507178534199

@TasinIshmam TasinIshmam added the kind/bug A reported bug. label Jun 29, 2022
@TasinIshmam TasinIshmam changed the title Unknown error in SQLite Connector migrating from Prisma 3.x to 4.0.0 for ARM/M1 Unknown error in SQLite Connector migrating from Prisma 3.x to 4.0.0 on ARM/M1 machines Jun 29, 2022
@garrensmith garrensmith added team/client Issue for team Client. tech/typescript Issue for tech TypeScript. labels Jun 29, 2022
@millsp millsp added bug/2-confirmed Bug has been reproduced and confirmed. tech/engines Issue for tech Engines. size/unknown and removed priority/high labels Jun 29, 2022
@millsp
Copy link
Member

millsp commented Jun 29, 2022

it looks like it’s that thing I’ve been constantly encountering since November or so with dev builds where macOS kills the Node.js process when trying to load the addon because our binaries aren’t signed

@millsp millsp added tech/typescript Issue for tech TypeScript. priority/high and removed tech/typescript Issue for tech TypeScript. priority/unknown labels Jun 29, 2022
@aqrln
Copy link
Member

aqrln commented Jun 29, 2022

It's not related to SQLite, it happens because macOS kills the Node.js process when trying to load the Query Engine library.

$ ts-node index.ts
zsh: killed     ts-node index.ts

$ find . -name libquery_engine-darwin-arm64.dylib.node | xargs codesign -f -s 'Oleksii Orlenko'
./node_modules/prisma/libquery_engine-darwin-arm64.dylib.node: replacing existing signature
./node_modules/.prisma/client/libquery_engine-darwin-arm64.dylib.node: replacing existing signature
./node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node: replacing existing signature

$ ts-node index.ts
0

@aqrln
Copy link
Member

aqrln commented Jun 29, 2022

#14058

@garrensmith
Copy link
Contributor

Step one for this to come up with a good way to fix this.

@aqrln
Copy link
Member

aqrln commented Jul 15, 2022

Fixed in #14301

@aqrln aqrln closed this as completed Jul 15, 2022
@janpio janpio added this to the 4.1.0 milestone Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: macos
Projects
None yet
Development

No branches or pull requests

7 participants