nitrojs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.build
MIT License
6.16k stars 507 forks source link

2.10: Can't run db code from plugins #2832

Open vladkrasn opened 3 hours ago

vladkrasn commented 3 hours ago

Environment

Node.js: 22 Nitro: 2.10

Reproduction

https://stackblitz.com/edit/github-f7duzj?file=nitro.config.ts,server%2Fplugins%2Fdb.ts

Describe the bug

[nitro] [unhandledRejection] ReferenceError: Cannot access 'instances' before initialization

Seems like plugin that executes SQL is run before Nitro initializes the default sqlite database.

Additional context

Worked fine in 2.9.7

Logs

No response