-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
cannot read stored value in asynclocalstorage when using finished #57844
Copy link
Copy link
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.async_local_storageIssues and PRs related to the AsyncLocalStorage API.Issues and PRs related to the AsyncLocalStorage API.confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
Description
Activity
Metadata
Metadata
Assignees
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.async_local_storageIssues and PRs related to the AsyncLocalStorage API.Issues and PRs related to the AsyncLocalStorage API.confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
Version
v22.14.0 and probably previous versions
Platform
Subsystem
stream, async_hooks
What steps will reproduce the bug?
While making a request and accessing AsyncLocalStorage, inside asyncLocalStorage the finished module is executed to access the value stored in the local storage.
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should be able to access the value stored in the local storage.
What do you see instead?
undefinedAdditional information
This is a test inside on-finished (see https://github.com/jshttp/on-finished/blob/f8b5f4097d28df79e466d1ffdf58ccb27d769156/test/test.js#L74)
This is important in order to use the
finishedfunction within thebody-parserpackage. It's part of my experiment to stop usingon-finished, but it will likely be merged if it passes all the tests, since the idea is to use the APIs provided by Node.jsexpressjs/body-parser#598