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

Nitro crashes on import of InstantDB admin SDK: [worker reload] [Error: [worker init] /.nitro/dev/index.mjs failed] [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/Reactor' Did you mean to import 'path/to/Reactor.js'? #3005

Open
mareszhar opened this issue Jan 17, 2025 · 0 comments

Comments

@mareszhar
Copy link

Environment

// nitro.config.ts
export default defineNitroConfig({
  srcDir: 'server',
  compatibilityDate: '2025-01-16',
})
- Operating System: `Darwin`
- Node Version:     `v22.13.0`
- Nitro Version:    `2.10.4`
- Package Manager:  `[email protected]`

Reproduction

Minimal repro in Nitro sandbox

PS: I first came across this issue in a Nuxt project, and initially prepared a minimal Nuxt Repro too. But, a fellow Nuxt + InstantDB user noticed the error could be triggered in a sandbox with just Nitro, and prepared the Nitro repro above.

Describe the bug

Importing/using InstantDB's admin SDK in Nitro raises an error and crashes the app.

Error overview:

[worker reload] [Error: [worker init] /.nitro/dev/index.mjs failed]
[cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/Reactor'  Did you mean to import 'path/to/Reactor.js'?

Additional context

I reviewed any related issues I could find in the Nuxt/Vue ecosystem (29943, 15500, 363, etc), but none of the workarounds I've tried fixed the issue.

I know InstantDB isn't developed by the Nitro team, but since their admin SDK worked fine for me in Node, and the error I ran into when using it with Nuxt server pointed at Nitro, I thought it'd be relevant to file the report here. If this wasn't the right space, please accept my apologies.

Thank you for your time, I appreciate any pointers! ❤

Logs

**Full error message:**

[worker reload] [Error: [worker init] /home/projects/github-tyi4jw9b-p8nnubwp/.nitro/dev/index.mjs failed] {
  [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/projects/github-tyi4jw9b-p8nnubwp/node_modules/@instantdb/core/dist/Reactor' imported from /home/projects/github-tyi4jw9b-p8nnubwp/.nitro/dev/index.mjs
  Did you mean to import /home/projects/github-tyi4jw9b-p8nnubwp/node_modules/@instantdb/core/dist/Reactor.js?
      at __node_internal_captureLargerStackTrace2 (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:101:5335)
      at new NodeError (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:101:4149)
      at finalizeResolution (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:10970)
      at moduleResolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:11119)
      at defaultResolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:12372)
      at ModuleLoader.defaultResolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:3284)
      at ModuleLoader.resolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:2989)
      at ModuleLoader.getModuleJob (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:1938)
      at https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:155:1047
      at _0x16cab6.link (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/blitz.1b4252dd.js:40:795699)
      at https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:155:1002 {
    url: 'file:///home/projects/github-tyi4jw9b-p8nnubwp/node_modules/@instantdb/core/dist/Reactor',
    code: 'ERR_MODULE_NOT_FOUND'
  }
}
@mareszhar mareszhar changed the title Nitro crashes on import of InstandDB admin SDK: [worker reload] [Error: [worker init] /.nitro/dev/index.mjs failed] Nitro crashes on import of InstantDB admin SDK: [worker reload] [Error: [worker init] /.nitro/dev/index.mjs failed] [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/Reactor' Did you mean to import 'path/to/Reactor.js'? Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant