Skip to content

Conversation

@finnp
Copy link

@finnp finnp commented Aug 15, 2025

When using multer the Async Local Storage gets lost. This is because the busboys event handler runs next and after event handlers the async context gets lost in Node.js.

This was reported in #814 and #1111

I added a feature detect AsyncStroage.bind to make sure the context is not lost.

I tested this based on the the multer-test repository by @C-Saunders and it worked 👏

Let me know what you think!

@finnp finnp changed the title Bind AsyncResource on busboy close event to preserve async context, Fixes #814 and #1111 Bind AsyncResource on busboy close event to preserve async context Aug 15, 2025
@finnp
Copy link
Author

finnp commented Aug 15, 2025

Also just added a test for this

@finnp
Copy link
Author

finnp commented Aug 16, 2025

I realize there are other attempts already at fixing this. Didn't see them through the search, e.g.: #1124. Would be great to get one solution merged. The linked one here seems maybe a tat more defensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant