-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[WARN] Astro.request.headers
is not available in "static" output mode.
#10212
Comments
Can confirm, running into the same issue right now. |
Will be fixed by #10196, sorry for the inconvenience. It's a bug with i18n in particular |
Awesome! Sorry, I searched existing issues but didn't think to search PRs. |
#10196 has been merged |
I've confirmed that this has been fixed as of 4.4.5, thanks everybody. |
I just upgraded to 4.5.9 and I'm running into this issue. The warning is only for my prerendered pages. I have |
can confirm this still is a problem with
|
This is intentional. You can't read headers in a static page. We do this on purpose so that you don't rely on behavior that will lead to build-time and run-time differences. |
@matthewp I'm not reading any headers though. EDIT: I was reading headers.. sorry |
---
import ThemeToggle from "./ThemeToggle";
const cookie = Astro.cookies.get("theme");
export const prerender = false;
---
<ThemeToggle themeCookie={cookie?.value} client:load /> I have a ThemeToggle component like this, this component is accessing cookie in headers. And my astro.config.mjs is |
Hint: this error occurs on symbolic linked files too, even if prerender is set to false. |
I encountered the same warning again in the latest update "4.16.1." I had to downgrade to "4.16.0" to make the warning disappear in a project created from scratch using |
Same here, running Astro on Cloudflare Workers. Just upgraded and started getting this warning. I also have an endpoint that started failing with this error on the server side:
(not sure if related or if this is a separate issue.) |
Same warning in 4.16.14 |
Same warning in "astro": "^4.16.13", |
@Mistwell update to the latest, this was fixed |
|
Encountered this issue on ---
return Astro.rewrite('/anohter-page')
--- Warning goes away if you pass new instance of Request ---
return Astro.rewrite(new Request(new URL('/another-page', Astro.url.origin)));
--- |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Since upgrading to Astro 4.4.3 I'm getting this warning in the console:
What's the expected result?
I was not getting this warning on Astro 4.3.7.
I'm not doing anything with
headers
AFAIK, but it would be nice to have a trace to know where this warning is coming from.I tried for some time but I'm having trouble reproducing this on Stackblitz or in a fresh project. As mentioned above, a trace would be nice. My project is simple, my only dependencies are Astro and Typescript.
Link to Minimal Reproducible Example
https://stackblitz.com/see-above
Participation
The text was updated successfully, but these errors were encountered: