-
Notifications
You must be signed in to change notification settings - Fork 4
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
Upgrading from 1.0.1 to 1.0.2 results in requestContext.get('key') returning undefined #8
Comments
@potyl Can't put my finger immediately on why that would be working previously, but I don't understand your use-case either. Why are you trying to use a part of plugin without using plugin itself? Hooks generated by |
@kibertoad the use-case is a simplification of what's happening on my application. Thanks for pointing out the issue that we're hitting. I see that we're not using the plugin properly. In my case I have a library that's agnostic to any web framework, the library is being used inside a fastify server but from the point of view of the library it doesn't require any dependency to fastify. The library does expose an "initialization" function that is expected to be used by a fastify app so that it can pass a context. That function uses a ALS to work. Then later on during the development ALS was needed inside the actual fastify app and the plugin was used without registering it. Somehow it worked fine with 1.0.1 and only during the upgrade did we notice a strange behavior. I will register the plugin for the bits in the fastify app that rely on |
Actually, ignore my last comment. I do see in the code that we are registering the plugin |
I see that if I upgrade |
Hi,
After upgrading asynchronous-local-storage from 1.0.1 to 1.0.2 any call to
requestContext.get('key')
to returnundefinded
.I was able to reproduce the issue with the following snippet:
Note that this might be due to a wrong usage of the library that manifest itself after the upgrade.
I noticed that if I uncomment
server.register(fastifyRequestContextPlugin);
that the ALS then works as expected.I have an app that doesn't register the plugin
fastifyRequestContextPlugin
and works fine when usingrequestContext
in 1.0.1 but fails and always getsundefined
once we upgrade to1.0.2
.Do we need to register the plugin
fastifyRequestContextPlugin
?Is there a regression in 1.0.2 that we're hitting?
The text was updated successfully, but these errors were encountered: