Getting error "Failed to publish your Function" when not using functions

Upon attempting to deploy, at the very end after uploading and everything it returns the error:

Error: Failed to publish your Function. Got error: Uncaught TypeError: Cannot read properties of undefined (reading 'console')

However, I’m not using functions with pages at the moment. I don’t even have a functions folder, so not sure what its talking about. It also builds fine locally. Anyone have any ideas on what I could check?

Are you doing SSR through any frameworks?

Yes - via Nuxt3. Also, im using the flag

NITRO_PRESET=cloudflare-pages

when building with npx nuxi build.

Well that’ll be why then, SSR requires server side work (Server Side Rendering) so that is what is generating the Function and has a code problem.
You should report it to the Nuxt team.

Gotcha - but in that case shouldn’t it be creating a functions folder in the root directory?

Depends, they could generate a functions directory in root or a _worker.js in output.
I’m not sure what Nuxt specifically does, I’d check the output dir and see if there’s a _worker.js in there

I do see a _worker.js file in the dist folder, so i presume its using that. Not sure how to fix this at the moment, but thanks giving me a place to start with it

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.