Closed faizananwerali closed 3 months ago
Just for information, I removed cloudflare and used node server adaptor for deployment testing.
import node from '@astrojs/node';
output: "server",
adapter: node({
mode: 'standalone',
}),
deployment was fully successful but obviously it didn't launch the website on cloudflare because i didn't use correct Adaptor. So there must be an issue with @astrojs/cloudflare Adaptor.
Got 404 error.
Looking for the fix in Adaptor or guide how to resolve this issue.
Cloudflare doesn't run on a Node runtime, that's why not everything is compatible.. But streams are compatible if you enable the correct flag, it even does tell you this in the error message: Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.
We do have documentation about this here: https://docs.astro.build/en/guides/integrations-guide/cloudflare/#nodejs-compatibility And Cloudflare also has documentation about it here: https://developers.cloudflare.com/workers/runtime-apis/nodejs#enable-nodejs-with-pages-functions
Appreciate it. For others facing the same issue, follow the documentation. Essentially, you have two options: either create a wrangler.toml file in your project or enable Node.js directly from the Dashboard.
Add the nodejs_compat compatibility flag to your wrangler.toml
:
wrangler.toml
compatibility_flags = [ "nodejs_compat" ]
To enable Node.js for your Pages Function from the Cloudflare dashboard:
nodejs_compat
compatibility flag to your Preview and Production deployments.This still does not work for me. I receive "Buffer is not defined" error evene with compatibility turned on
This still does not work for me. I receive "Buffer is not defined" error evene with compatibility turned on
Please open a new issue with a minimal reproduction.
Astro Info
Describe the Bug
What's the expected result?
Don't know what happend but it is not working
Link to Minimal Reproducible Example
https://github.com/withastro/astro
Participation