Importing the schema generated by Instant CLI in server-side code causes an error (a detailed transcript of the
error message is available in the Reproduction steps section).
The source of the error in this repro is in /server/api/checkIfRegistered.post.ts.
That file contains a sample intended use that runs into the error. But, the error arises just by importing server-side the
schema generated by Instant CLI in instant.schema.ts. So, even this very simplified snippet raises the same
error:
Though here's the expanded sample use-case you'll find in /server/api/checkIfRegistered.post.ts:
# pnpm
pnpm installNUXT_PUBLIC_INSTANT_APP_ID="YOUR_INSTANT_APP_ID_OR_A_DUMMY_STRING"
NUXT_INSTANT_APP_ADMIN_TOKEN="YOUR_INSTANT_ADMIN_TOKEN_OR_A_DUMMY_STRING"Since the issue arises just by importing the schema generated by Instant CLI in instant.schema.ts,
it's not even needed to define legitimate env variables yet. This minimal demo presents an
imaginary app that checks if a user is registered in an InstantDB app so, if you do want to get a
working version of that, you'd have to (a) find a way to fix the issue in this demo and (b) provide
valid env variables.
# pnpm
pnpm devError: [worker reload] [worker init] /path/to/project/.nuxt/dev/index.mjs failed
[cause]: Cannot find module '/path/to/project/node_modules/.pnpm/@instantdb+core@0.17.7/node_modules/@instantdb/core/dist/Reactor' imported from '/path/to/project/.nuxt/dev/index.mjs'
Did you mean to import '/path/to/project/node_modules/.pnpm/@instantdb+core@0.17.7/node_modules/@instantdb/code/dist/Reactor.js'?
Did you mean to import "node_modules/.pnpm/@instantdb+core@0.17.7/node_modules/@instantdb/core/dist/Reactor.js"?
at finalizeResolution (node:internal/modules/esm/resolve:275:11)
at moduleResolve (node:internal/modules/esm/resolve:932:10)
at defaultResolve (node:internal/modules/esm/resolve:1056:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
at ModuleJob._link (node:internal/modules/esm/module_job:135:49)It is posssible to import and use the schema generated by Instant CLI in the server-side code to
initialize the InstantDB admin SDK.