Open RaphaelBossek opened 1 month ago
I think this issue would be same to #11751, @bholmesdev
@RaphaelBossek can you provide more context or reasons about why this is a bug?
In particular, please provide:
The advice is to change to output mode "hybrid" but I'm in "hybrid" mode.
This warning can be surpressed when the cookie getter code is removed from the middleware function.
I've applied an "working" example at https://stackblitz.com/~/github.com/RaphaelBossek/astro-auth-middleware-test with this warning, so your questions are answered within the short "code". Could you pleaes precise your questions based on the Minimal, Reproducible Example.
I think this warning might brought by recent changes in astro action. Before ver 4.13.2 there is no warning when build.
From: @hephaistos_DE @.> Sent: Sunday, August 18, 2024 8:31:25 PM To: withastro/astro @.> Cc: Ciel @.>; Comment @.> Subject: Re: [withastro/astro] Warning messages when reading cookies in middleware functions with hybrid output (Issue #11756)
The advice is to change to output mode "hybrid" but I'm in "hybrid" mode. I've applied an "working" example at https://stackblitz.com/~/github.com/RaphaelBossek/astro-auth-middleware-test with this warning, so your questions are answered within the short "code". Could you pleaes precise your questions based on the Minimal, Reproducible Example.
— Reply to this email directly, view it on GitHubhttps://github.com/withastro/astro/issues/11756#issuecomment-2295245346, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALFPQ5J2NGJS5WEZEA7AHT3ZSCHZ3AVCNFSM6AAAAABMVGZ6BOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGI2DKMZUGY. You are receiving this because you commented.Message ID: @.***>
Its the same as https://github.com/withastro/astro/issues/11751 The error message was fixed at one point. But then got reintroduced at some point.
Hey @RaphaelBossek! Thanks for reporting. It seems that middleware runs on prerendered routes in development, which trips that warning log when accessing headers or cookies.
We have some Astro maintainers discussing how to expose whether a route is prerendered or not so you can check this from middleware. You can join the discord to discussion in #feedback-ideas! For now, you can safely ignore the warning.
It's available in 5.0 beta, you can use context.isPrererendered
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Not a browser problem
Describe the Bug
While reading cookies in middleware function result in following warning:
What's the expected result?
No warning message.
Link to Minimal Reproducible Example
https://stackblitz.com/~/github.com/RaphaelBossek/astro-auth-middleware-test
Participation