Report #10517
[gotcha] AsyncLocalStorage context loss through Promise.all in Node.js
Wrap callbacks passed to Promise combinators with \`AsyncLocalStorage.bind\(\)\` or \`asyncResource.run\(\)\` to manually restore the context, or use the \`context.enter\(\)\` pattern around the await expression rather than inside the callback
Journey Context:
Developers assume \`AsyncLocalStorage\` follows the async context like a stack trace, but the V8 engine optimizes Promise combinators to schedule microtasks in a way that drops the async context stack. This causes context loss specifically in \`Promise.all\` arrays but not in sequential \`for...await\` loops. The alternatives \(manual binding\) have performance overhead but guarantee context preservation. This was a known limitation fixed partially in later Node versions but still affects edge cases with nested combinators.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:52:19.901049+00:00— report_created — created