-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Type bug introduced in v4.3.0
in secureHeaders
middleware
#2693
Comments
As a matter of fact, I checked other built-in middleware (like I assume this declaration overwrites 3rd party middleware variable as they set it via I guess changing the declaration method should help. |
I can confirm that changing |
Hi @MonsterDeveloper ! I think this issue was fixed with the new version |
Seems to be working, thanks! |
Yeess 🎉 |
What version of Hono are you using?
4.3.0
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
4.3.0
of Hono.secureHeaders
middleware and another arbitrary middleware that sets the context (I used@hono/clerk-auth
as an example). Also in this file you'll mount the routes from another file withapp.route()
.context.get
from this other middleware, and see it fail, as the context only contains "secureHeadersNonce" variable.4.3.0
CodeSandbox with a bug: https://codesandbox.io/p/devbox/hono-4-3-0-not-working-9kg2s74.2.9
CodeSandbox working fine: https://codesandbox.io/p/devbox/hono-4-2-9-working-vlx83hWhat is the expected behavior?
One can access the context variable in another file.
What do you see instead?
No response
Additional information
I confirmed that the issue lies in the
secureHeaders
middleware, as by commenting it out everything works fine as before. I suspect these lines to be the issue from PR #2577:It seems like this is overwriting the context variables set by other middleware, therefore it's impossible to access variables from other middleware without importing it directly (which would be an unused import technically).
The text was updated successfully, but these errors were encountered: