-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nestjs
SDK Version
10.15.0
Framework Version
11.0.1
Link to Sentry event
Reproduction Example/SDK Setup
It looks like Sentry's performance tracing enters a mostly "suppressed" state immediately on application startup if any controller in the NestJS project is decorated with @UseInterceptors(FileInterceptor(...)) (FileInterceptor from NestJS for file uploads)
The weirdest part is that you don't even have to call the file upload endpoint. Just having the @UseInterceptors(FileInterceptor(...)) line in any controller is enough to cause the issue right when the app starts up
The problem is not a runtime conflict on the request stream, but seems to be an initialization-time conflict during the NestJS application bootstrap (NestFactory.create()).
When the FileInterceptor line is commented out everything works perfectly.
When the FileInterceptor line is active it causes a problem where any action within the nestjs app generates only a single span
My guess is that when NestJS boots up and sees the FileInterceptor, it loads multer early. This seems to be conflicting with how Sentry works.
Steps to Reproduce
-
Set sentry's debugger option to true.
-
Call any endpoint you might have within your project. Example:
@Get('someEndpointYouMightHave')
yourControllerFunctionHere() {
this.callYourServiceHere();
}
- Check how many spans are created and keep the value in mind. Example:
Sentry Logger [log]: SpanExporter exported 7 spans, 0 spans are waiting for their parent spans to finish
- Place this line of code (below) within any controller of your project. Example:
NOTE: I placed in this case within the same controller I showed above, but you can place it within any other controller and call the first controller that you used to test.
@Get('someEndpointYouMightHave')
@UseInterceptors(FileInterceptor('file')) // <-- THE PROBLEMATIC LINE
yourControllerFunctionHere() {
this.callYourServiceHere();
}
- Check how many spans are created and compare the results:
Sentry Logger [log]: SpanExporter exported 1 spans, 0 spans are waiting for their parent spans to finish
Expected Result
Sentry Logger [log]: SpanExporter exported 7 spans, 0 spans are waiting for their parent spans to finish
Actual Result
Sentry Logger [log]: SpanExporter exported 1 spans, 0 spans are waiting for their parent spans to finish
Additional Context
No response
Metadata
Metadata
Assignees
Projects
Status