Pages deployment failed if functions are includes

I use Cloudflare pages for deploying a static nuxt 3 app and want to have one worker/functions endpoint for a contact form. The deployment of the static files works fine but if I add the functions directory than the deployment fails and I can’t see any error logs.

Here are some screenshots:
Folder I uploaded ./.output/public

Screen Shot 2022-11-06 at 21.38.13

Your functions directory should be next to you public one, not inside it. Can you try that and then provide a full build output log if it continues to fail?

OK I tried it to move the functions dir one level up and nothings changed. Deployment failed again.

I use wrangler for the deployment npx [email protected] pages publish "./.output/public" --project-name="<my-project>" and wrangler said Deployment complete!. If I look into the deployment I see no function and a failed status, but no logs

don’t know why i can’t edit my post, but i have the functions dir on root level of the project and i copied it into the .output dir

You’re getting the error: “Uncaught ReferenceError: __dirname is not defined at worker.mjs:5357:18”

__dirname is a NodeJS API

1 Like

Oh, thanks for the quick answer. So it might be a but in nitojs I think.

Is there on option that I can also see these error logs?

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