question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using `nApi` preview feature flag: `Can't modify an already connected engine.`

See original GitHub issue

Bug description

Hi. A while ago I made this issue about nApi. And because I couldn’t use it, I removed nApi from my project. But I started using it again a couple of days ago.

Since I started using it again. I haven’t had a problem with production and no errors like the issue above. But I started getting a new error in development on my own PC (windows 10).

Error:

(node:5568) UnhandledPromiseRejectionWarning: 
Error: {
"is_panic":false,
"message":"Can't modify an already connected engine.",
"backtrace":"   0: napi_register_module_v1\n  
 1: napi_register_module_v1\n   2: napi_register_module_v1\n   3: <unknown>\n   4: <unknown>\n   5: <unknown>\n   6: <unknown>\n   7: <unknown>\n   8: <unknown>\n   9: napi_register_module_v1\n  10: napi_register_module_v1\n  11: napi_register_module_v1\n  12: napi_register_module_v1\n  13: napi_register_module_v1\n  14: napi_register_module_v1\n  15: napi_register_module_v1\n  16: napi_register_module_v1\n  17: napi_register_module_v1\n  18: napi_register_module_v1\n  19: napi_register_module_v1\n  20: BaseThreadInitThunk\n  21: RtlUserThreadStart\n"}

I use nodemon (v 2.0.9) with express (v 4.17.1).

My main database is Postgress (which I use Prisma for), and redis with node-redis (v 3.1.2) which runs in a windows Ubuntu (WSL) terminal.

I use the integrated git bash for vscode as my main terminal (where I run nodemon).

How to reproduce

  1. open an express project that uses postgress Prisma and nApi
  2. open git bash in vscode + ubuntu (WSL) terminal that runs redis with node-redis
  3. run the project with nodemon
  4. stop nodemon using CTRL+C
  5. start it immediately after
  6. see error

Expected behavior

Connect to the already existing engine instead of throwing this error.

Prisma information

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["selectRelationCount", "nApi"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

...

Environment & setup

  • OS: Windows 10 Pro version 21H1
  • Database: PostgreSQL 13
  • Node.js version 14.17.2
  • Nodemon version 2.0.9
  • Git bash version 2.32.0.2

Prisma Version

prisma               : 2.29.0
@prisma/client       : 2.29.0
Current platform     : windows
Query Engine         : query-engine 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine     : migration-engine-cli 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary        : prisma-fmt 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 1be4cd60b89afa04b192acb1ef47758a39810f3a
Studio               : 0.419.0
Preview Features     : selectRelationCount, nApi

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mostafa7904commented, Jun 2, 2022

I haven’t personally seen any reoccurrence of this either. I’ll reopen another issue if it happens again.

1reaction
janpiocommented, Aug 24, 2021

That’s fine, thanks for letting us know. We will see if we can get this fixed (or worked around).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling Node-API libraries: Remove `nApi` preview feature ...
Now when a user just installs and uses Prisma, they directly get the Node-API library instead of the binary everywhere. The preview feature...
Read more >
Prisma Client and Prisma schema preview features
Enabling a Prisma Client preview feature. To enable a Prisma Client preview feature: Add the preview feature flag to the generator block:.
Read more >
Feature flags - GitLab Docs
With feature flags, you can deploy your application's new features to production in smaller batches. You can toggle a feature on and off...
Read more >
Feature Flags: The Hidden Switch Behind Continuous ...
Feature flags allows you to ship code more frequently, test on production, and wow your users by revealing the feature at the right...
Read more >
Introducing AWS AppConfig Feature Flags In Preview
Update (15 March 2022): AWS AppConfig Feature Flags are now ... AWS customers use AWS AppConfig to centrally manage and deploy their ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found