You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TorbjornHoltmon
changed the title
Cloudflare runtime context not available on 404 pages when buffering response body in middleware
Cloudflare runtime context not available on 404 pages in middleware
Dec 23, 2024
I was wrong about the body buffering, it had nothing to do with the issue.
The context is just not available in middleware on 404 pages (404 rewrites?).
TorbjornHoltmon
changed the title
Cloudflare runtime context not available on 404 pages in middleware
Cloudflare runtime context not available in middleware on 404 page
Dec 23, 2024
Astro Info
Describe the Bug
EDIT
Buffering the body had nothing to do with the issue, I don't know why I got stuck in that thought.
The issue is simply Cloudflare context is not available in middleware on 404 pages in dev.
It works fine when deployed to cloudflare.
When buffering the body in Astro middleware, the Cloudflare context is unavailable in development.Example of buffering body in middleware:The full example can be found in repro, running the repro in dev and going to any two-segment route (
/123/456
) will trigger the error.I am not sure if this is an adapter issue or a astro main repo issue.
I am starting here, since it is the Cloudflare context that is unavailable.
What's the expected result?
The Cloudflare context should always be available in middleware
Link to Minimal Reproducible Example
https://github.com/TorbjornHoltmon/missing-cloudflare-context-repro
Participation
The text was updated successfully, but these errors were encountered: