Astro v4.9.2
Node v18.20.3
System Linux (x64)
Package Manager pnpm
Output hybrid
Adapter @astrojs/cloudflare
Integrations @sanity/astro
@astrojs/react
Describe the Bug
There are actually 2 bugs I've found:
1) I can't even get the minimal repro to build:
Cannot access '_renderer0' before initialization
Stack trace:
at async BuildPipeline.retrieveManifest (file:///home/projects/github-emesfy/node_modules/astro/dist/core/build/pipeline.js:125:26)
at async Module.staticBuild (file:///home/projects/github-emesfy/node_modules/astro/dist/core/build/static-build.js:130:7)
For whatever reason, I'm not seeing this in my actual repo (but I'm using pnpm whereas stackblitz uses npm so that could be it)
2) The actual bug I wanted to report:
With the sanity plugin, I'm embedding the Sanity studio in my app (in the example at /studio), as per this guide. This actually works when you run astro dev, and the /studio route loads and the Sanity studio renders. However, when I run astro build and deploy on Cloudflare, my /studio route throws an exception that a prerender_{HASH} file is missing. Looking into the dist folder, indeed that file seems to be missing, which I believe is a similar issue to https://github.com/withastro/adapters/issues/211.
My hunch is that it's got something to do with these lines where the route added by the integration is using prerender to generate the route... but then not actually prerendering. All I can tell is that the cloudflare integrations is removing the prerender chunk, causing it to explode in production builds.
What's the expected result?
The studio route should work in production.
For now, I've done a dirty and added an actual pages/studio.astro with this content:
Astro Info
Describe the Bug
There are actually 2 bugs I've found:
1) I can't even get the minimal repro to build:
For whatever reason, I'm not seeing this in my actual repo (but I'm using pnpm whereas stackblitz uses npm so that could be it)
2) The actual bug I wanted to report:
With the sanity plugin, I'm embedding the Sanity studio in my app (in the example at
/studio
), as per this guide. This actually works when you runastro dev
, and the/studio
route loads and the Sanity studio renders. However, when I runastro build
and deploy on Cloudflare, my/studio
route throws an exception that aprerender_{HASH}
file is missing. Looking into thedist
folder, indeed that file seems to be missing, which I believe is a similar issue to https://github.com/withastro/adapters/issues/211.My hunch is that it's got something to do with these lines where the route added by the integration is using prerender to generate the route... but then not actually prerendering. All I can tell is that the cloudflare integrations is removing the prerender chunk, causing it to explode in production builds.
What's the expected result?
The studio route should work in production.
For now, I've done a dirty and added an actual
pages/studio.astro
with this content:Which generates a
chunk/studio_HASH.mjs
page that correctly renders the studio.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-emesfy?file=astro.config.mjs
Participation