Why do stack traces just vanish across async boundaries, and how do you keep request context attached to your errors?
A strong answer can name the actual mechanism behind async stack loss, and point at the specific places AsyncLocalStorage stops carrying context
The stack traces go missing because the callback runs later, on a completely different stack. By the time the async operation completes, the code that started it has already returned, so the trace only shows the completion machinery from the event loop. Async/await mostly fixes this, I believe V8 can stitch the awaited frames together, which is one more reason to prefer it over raw callbacks. Request context is about knowing which request produced an error five layers deep. The standard tool is AsyncLocalStorage. You run each request inside als.run(store, handler), and then anything transitively called can read the store, so your loggers pick up the request id on their own. Combine that with correlation ids passed between services and you get traceable errors without threading a context argument through every function signature.