#Difference deploy behavior from wrangler CLI and Cloudflare website.

9 messages · Page 1 of 1 (latest)

cyan lichen
#

When I deploy a project across git CLI and already connect Cloudflare Works, and it builds successfully, you can view it at https://be758b82.balanced-chef.pages.dev/, it can open, but the /blog/* page doesn't work, I check everything is OK.

After, I tried to deploy the project through npx wrangler pages deploy dist, and it worked well on every page, you can see it at https://fe5e61f6.balanced-chef.pages.dev/

What's wrong?

terse bloom
#

Hi @cyan lichen I see identical responses (404) from those 2 urls with /blog/.

b.t.w. if your site is all static, I would suggest not using the @astrojs/cloudflare adapter. Cloudflare Pages is quite happy serving the static build without workers.

https://docs.astro.build/en/guides/integrations-guide/cloudflare/

If you’re using Astro as a static site builder, you don’t need an adapter.

Docs

Learn how to use the @astrojs/cloudflare SSR adapter to deploy your Astro project.

cyan lichen
terse bloom
#

@cyan lichen I suspect that you are hitting this astro issue
#1276586107869466726 message
The cloudflare astro adapter sets the rendering mode to server. This causes errors with templates which were not tested with SSR (like the blog template)
I would suggest not using SSR unless you have to.

terse bloom
#

to test this, try changing to output: 'hybrid' .

terse bloom
#

alternatively, you could add export const prerender = true; to the relevant .astro file.

terse bloom
#

PS - I answered your environment variable question in the community forum.