Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
I can chain multiple interceptors with observables to persist the current AsyncLocalStorage context, but when an error is thrown anywhere in the project, the context is lost at the global exception filter
Minimum reproduction code
https://github.com/darcyrush/nestjs-async-local-storage
Steps to reproduce
- npx ts-node src/main
- curl -H "x-id: 123" http://localhost:3000/success
- curl -H "x-id: 123" http://localhost:3000/failure
Expected behavior
I expect some way to propagate the AsyncLocalStorage callback to the global exception filter
Package
- I don't know. Or some 3rd-party package
-
@nestjs/common
-
@nestjs/core
-
@nestjs/microservices
-
@nestjs/platform-express
-
@nestjs/platform-fastify
-
@nestjs/platform-socket.io
-
@nestjs/platform-ws
-
@nestjs/testing
-
@nestjs/websockets
- Other (see below)
Other package
No response
NestJS version
11.1.3
Packages versions
"@nestjs/common": "^11.1.3",
"@nestjs/core": "^11.1.3",
"@nestjs/platform-express": "^11.1.3",
Node.js version
24.0.1
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
I asked already in the NestJS Discord; thread here
It appears that this may be an issue with HTTP specifically; Papooch/nestjs-cls#5