N
Nuxt5mo ago
takburger

Help debugging - illegal invocation rejection - nuxt hub

Hello Yesterday while starting my project in dev, I got "illegal invocation" error from Nitro and so far I was unable to identify the issue or do a reproduction. I need help identifying the issue please. Here is the message I'm having in the terminal :
ERROR [nitro] [unhandledRejection] Illegal invocation

at Object.waitUntil (node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/wrangler-dist/cli.js:210509:13)
at H3Event.event.waitUntil (node_modules/.pnpm/[email protected][email protected]_@[email protected]_@opentelemetry+api@_teyskodm67itc45mrvrgk57ica/node_modules/nitropack/dist/runtime/app.mjs:96:22)
at captureError (node_modules/.pnpm/[email protected][email protected]_@[email protected]_@opentelemetry+api@_teyskodm67itc45mrvrgk57ica/node_modules/nitropack/dist/runtime/app.mjs:38:23)
at Object.onError (node_modules/.pnpm/[email protected][email protected]_@[email protected]_@opentelemetry+api@_teyskodm67itc45mrvrgk57ica/node_modules/nitropack/dist/runtime/app.mjs:45:7)
at Server.toNodeHandle (node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2274:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERROR [nitro] [unhandledRejection] Illegal invocation

at Object.waitUntil (node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/wrangler-dist/cli.js:210509:13)
at H3Event.event.waitUntil (node_modules/.pnpm/[email protected][email protected]_@[email protected]_@opentelemetry+api@_teyskodm67itc45mrvrgk57ica/node_modules/nitropack/dist/runtime/app.mjs:96:22)
at captureError (node_modules/.pnpm/[email protected][email protected]_@[email protected]_@opentelemetry+api@_teyskodm67itc45mrvrgk57ica/node_modules/nitropack/dist/runtime/app.mjs:38:23)
at Object.onError (node_modules/.pnpm/[email protected][email protected]_@[email protected]_@opentelemetry+api@_teyskodm67itc45mrvrgk57ica/node_modules/nitropack/dist/runtime/app.mjs:45:7)
at Server.toNodeHandle (node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2274:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
It seems to happen when an /api/ route is requested. On the frontend it throws a 404 in the javascript console. By checking my commit history, I was also not able to identify anything meaningful around that date. I did update dependencies, but reversing that update or reproducing such update on an empty project did nothing.
8 Replies
mrk
mrk5mo ago
I'm having the same issue and have not been able to find a fix... anyone? 🙏
Torch
Torch5mo ago
Same issue, been struggling to solve this whole day. In my case, I can call the api route fine if there is no problem with my nuxt hub DB, but if there i some problem with DB (like invalid sql, or empty not nullable value, or even if I use throw createError this error ocurs.
mrk
mrk5mo ago
It might be due to invalid routeRules in nuzt.config, try commenting them out and see if that fixes it for you, it somehow did for me, though not sure what was invalid
Torch
Torch5mo ago
no routeRules for me in nuxt.config :/ it's clearly a problem on dev/localhost. Everything is working ok on production are you guys using compatibilityVersion: 4 in nuxt.config?
takburger
takburgerOP5mo ago
I wasn't. But I rebuilt the project entirely with compat 4 this weekend so I could review my code the hard way and deploy differently. I don't have that bug now... but last time I didn't have the bug until I had it.
Torch
Torch5mo ago
I tried rebuilding the project from scratch also, but did not help. Then I restarted my PC, and the problem is gone . I am happy, but as you said, this can repeat in fututre.
takburger
takburgerOP5mo ago
did it eventually happen after you updated packages ? I just came back on another project using nuxt hub and did pnpm up It gave me the illegal invocation right after
Yizack
Yizack5mo ago
For people having this problem, the issue comes from recent changes in wrangler package, lock its version to 3.63.0 as a workaround in your package.json dependencies and the issue should be gone for now
- "wrangler": "^3.65.0"
+ "wrangler": "3.63.0"
- "wrangler": "^3.65.0"
+ "wrangler": "3.63.0"
[unhandledRejection] Illegal invocation error seems to happen in dev only
Want results from more Discord servers?
Add your server