Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.2.1
Framework Version
@nestjs/core@10.3.8, @nestjs/graphql@12.1.1
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn: [redacted],
integrations: [nodeProfilingIntegration()],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
})
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule)
Sentry.setupNestErrorHandler(
app,
new BaseExceptionFilter(app.getHttpAdapter()),
)
await app.listen(config.port)
}
Steps to Reproduce
- Clone this repo: https://github.com/Blargel/sentry-nestjs-graphql-test
npm install
- Open
src/main.ts and change the DSN const to something valid.
npm start
- In a web browser, go to http://localhost:3000/
- Observe that an error is raised and reported to Sentry correctly. This is a regular HTTP endpoint with an error and works as expected.
- In a web browser, go to http://localhost:3000/graphql
- This will open a GraphQL explorer. I believe it defaults to the correct query for testing but if not, the correct test query is
query {hello}.
- Execute the query by pressing the play button in the top middle of the GraphQL explorer.
- Observe that a strange
TypeError is raised and the original error is not sent to Sentry correctly.
Expected Result
The GraphQL error should also be reported to Sentry without raising the strange TypeError.
Actual Result
No error reported in Sentry and the following error is thrown:
TypeError: response.status is not a function
at ExpressAdapter.reply (~/platform-api/node_modules/@nestjs/platform-express/adapters/express-adapter.js:28:22)
at BaseExceptionFilter.handleUnknownError (~/platform-api/node_modules/@nestjs/core/exceptions/base-exception-filter.js:46:28)
at BaseExceptionFilter.catch (~/platform-api/node_modules/@nestjs/core/exceptions/base-exception-filter.js:17:25)
at Proxy.<anonymous> (~/platform-api/node_modules/@sentry/src/integrations/tracing/nest.ts:80:51)
at ExternalExceptionsHandler.invokeCustomFilters (~/platform-api/node_modules/@nestjs/core/exceptions/external-exceptions-handler.js:31:32)
at ExternalExceptionsHandler.next (~/platform-api/node_modules/@nestjs/core/exceptions/external-exceptions-handler.js:14:29)
at ~/platform-api/node_modules/@nestjs/core/helpers/external-proxy.js:14:42
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.2.1
Framework Version
@nestjs/core@10.3.8, @nestjs/graphql@12.1.1
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
npm installsrc/main.tsand change the DSN const to something valid.npm startquery {hello}.TypeErroris raised and the original error is not sent to Sentry correctly.Expected Result
The GraphQL error should also be reported to Sentry without raising the strange TypeError.
Actual Result
No error reported in Sentry and the following error is thrown: