Difference deploy behavior from wrangler CLI and Cloudflare website.
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?
Home
Astro description
7 Replies
Hi @Sgal I see identical responses (404) from those 2 urls with /blog/.
- https://be758b82.balanced-chef.pages.dev/blog/
- https://fe5e61f6.balanced-chef.pages.dev/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
@astrojs/cloudflare
Learn how to use the @astrojs/cloudflare SSR adapter to deploy your Astro project.
I have also created a new topic in Cloudflare Comunity: Difference deploy behavior from wrangler CLI and Cloudflare website(https://community.cloudflare.com/t/difference-deploy-behavior-from-wrangler-cli-and-cloudflare-website/702540)
This URL(https://fe5e61f6.balanced-chef.pages.dev) published by wrangle CLI works well. It Route at Card(https://fe5e61f6.balanced-chef.pages.dev/blog/Card).
Home
Astro description
@Sgal I suspect that you are hitting this astro issue
https://discord.com/channels/830184174198718474/1276586107869466726/1279006502442635309
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.
to test this, try changing to
output: 'hybrid'
.alternatively, you could add
export const prerender = true;
to the relevant .astro file.
PS - I answered your environment variable question in the community forum.I see, I'll continue to focus on it, and the test uses dotenv to obtain environment variables.