-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Warning messages when reading cookies in middleware functions with hybrid output #11756
Comments
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 GitHub<#11756 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALFPQ5J2NGJS5WEZEA7AHT3ZSCHZ3AVCNFSM6AAAAABMVGZ6BOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGI2DKMZUGY>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Its the same as #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 |
|
Looks like it's still called
... and not officially part of the context yet.
Apart from that, it works fine! |
That's because the change is on the next branch |
I just tried the user's reproduction, and I can't see the warning anymore when using Closing as completed |
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
The text was updated successfully, but these errors were encountered: