Cannot deploy Nuxt app to pages. Build completes, but after publish I get a minified runtime error
my pages.dev link : woom-v2-nuxt3-cloudflare-autodeploy.pages.dev
deployment id : 0ac92c74-e72e-4969-8256-1fcedfbba7ee
I am consistently getting a runtime error after the publish succeeds.
Given that the error is coming from minified js, that I do not have access to, this is making it impossible to figure out exactly what the problem is.
2:46:05.130 Success: Assets published!
12:46:06.565 Error: Failed to publish your Function. Got error: Uncaught TypeError: Cannot read properties of undefined (reading 'exports')
at functionsWorker-0.8391131841286965.js:21419:92
when I build and run using wrangler locally, I get a similar error
service core:user:worker: Uncaught TypeError: Cannot read properties of undefined (reading 'exports')
at bh25zprwrab.js:21509:92
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
However I can never find the file it refers to [bh25zprwrab.js in this case]
any help would be greatly appreciated
4 Replies
I ran into this the other day. I unminified and dug into the _worker.js with my nitro preset with minify false and then tracked down the erroring code… so in your case line 21509
I did that to mine and determined the code was associated with a library i did not need and it was baked into a server side library i wasnt using
@.crossbeau thanks for this. Can you tell me where the setting is in config to switch minify to false? I can probably find it myself, but I've had trouble in the past where google says something is in 3 places, and none of them work
👋 also following this issue 😉
OK, finally figured this out. wrangler/miniflare places build outputs in your /tmp folder. The output js file ends up in a few locations : The one in the root of /tmp is smaller, with include references. The one in a sub-directory of /tmp has the imports included in the single file. This is the one where I was able to finally find the offending line.
In this case, it ended up being the vue-i18n library I was using. I bumped it to the latest beta version, and the error went away.