-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Can't modify immutable headers. in Cloudflare Pages after updating to 4.16.1 #12201
Comments
Possibly caused by this change: |
Wondering if this should change to:
I'm missing context around this, but it looks like |
I feel like set should be fine here after doing a bit of digging This might be a bit above my skill level but to me it seems the issue would be caused by not duplicating the request in that utility function first (so it’s mutable), modifying it, and returning the modified request I could be way off base though |
I had the same issue, downgrading to [email protected] fixed it. |
This is correct - in Cloudflare Pages / Workers, the request must be duplicated to make it mutable: async fetch(request, env, ctx) {
request.headers.set('x-foo', 'bar') // FAIL
// Duplicate request to make it mutable
const req = new Request(request)
req.headers.set('x-foo', 'bar') // WORKS!
return new Response('hello world')
}, |
Sorry for the inconvenience everyone. For now I'd suggested pinning Astro to {
"dependencies": {
"astro": "4.16.0"
}
} We'll likely only able to get to fixing this next Monday, but I'll check with the team if we should revert #12173 for now, which seems to be the cause here. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
After building with
4.16.1
my site running on Cloudflare Pages inhybrid
mode 500's on all non-prerendered routes.Looking at the realtime logs I see complaints about headers:
In the build output there's also a bunch of warnings now that hadn't been there up to this point:
Locking the version to
4.16.0
and re-deploying fixed it.What's the expected result?
I would expect these routes to work.
Link to Minimal Reproducible Example
https://hotfix-hide-entire-countdown.wildatheart1.pages.dev/the-series
Participation
The text was updated successfully, but these errors were encountered: