Wrangler pages publish always fails (Tried both with NextJS and with Astro templates)

Steps to reproduce:

Clone: https://github.com/luccasmmg/astro-template (This is literally just the astro template with the cloudflare integration installed on top)
Run: “npm run build”
Run: “npx wrangler pages deploy dist”

The output says that everything is fine

🌍  Uploading... (2/2)

✨ Success! Uploaded 0 files (2 already uploaded) (0.48 sec)

✨ Compiled Worker successfully
✨ Uploading Worker bundle
✨ Uploading _routes.json
✨ Deployment complete! Take a peek over at `https://5db9391a.portal-datopian-support.pages.dev`

But when i try accessing the cloudflare dashboard i get this

I believe this is a problem with the wrangler cli because i made another minimal reproduction based on the nextjs tutorial in https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/ https://github.com/datopian/next-template and the same issue happens.

Running npx wrangler pages dev dist will work fine

Wrangler doesn’t wait for functions deployment it seems, so it reports a success but then something with your Function is error. This creates a pretty poor development experience, sorry about that, but hopefully we can help you get to the bottom of the issue.

Can you share a deployment ID so someone on the Pages team can take a closer look please?

The Pages deployment ID is a unique build identifier.
It’s the UUID in the browser bar (for example, a URL would be dash.cloudflare.com/ACCOUNT_ID/pages/view/PROJECT/DEPLOYMENT_ID where the deployment ID looks something like a398d794-7322-4c97-96d9-40b5140a8d9b).

I’ve also created an issue for tracking this kind of thing:

Hopefully that’ll be improved so the DX here isn’t as rough.

1 Like

I actually think i’ve just found the issue

I went back in the nextjs tutorial to get a new deployment so that i could provide you with a deployment id, and i saw something that i missed which was the possibility of running npm create cloudflare@latest my-next-app -- --framework=next which automatically does the deployment and low and behold it worked.

But that left me wondering, why does it work here and not when i try to run npx wrangler pages deploy .vercel/output/static --project-name={my project} --branch=main so i started looking into everything in the dashboard and the only thing that i could find different were the compat flags, my project had both nodejs_compat and url_standard while the one created by the npm create cloudflare... cli only had nodejs_compat so i decided removing it and it worked.

I cant exactly remember why i ended up adding it, probably something to do with the fact that i created the project using the API here https://developers.cloudflare.com/api/operations/pages-project-create-project i must’ve read Example: url_standard as Default: url_standard and ended up putting there.

Tested the astro-template without that flag and it worked as well

ANYWAY, i think my problem is pretty much fixed, thanks a lot and sorry for the trouble

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