Title: How to prevent handleFastifyError.handleFastifyError errors in Sentry? · Issue #17119 · getsentry/sentry-javascript · GitHub
Open Graph Title: How to prevent handleFastifyError.handleFastifyError errors in Sentry? · Issue #17119 · getsentry/sentry-javascript
X Title: How to prevent handleFastifyError.handleFastifyError errors in Sentry? · Issue #17119 · getsentry/sentry-javascript
Description: Problem Statement In my route handles, I throw Response objects like: throw Response.json( { error: { code, details, id: sentryErrorForeignId, message, }, } satisfies ApiErrorResponse, { headers, status, }, ); It works as expected with F...
Open Graph Description: Problem Statement In my route handles, I throw Response objects like: throw Response.json( { error: { code, details, id: sentryErrorForeignId, message, }, } satisfies ApiErrorResponse, { headers, s...
X Description: Problem Statement In my route handles, I throw Response objects like: throw Response.json( { error: { code, details, id: sentryErrorForeignId, message, }, } satisfies ApiErrorResponse, { headers, s...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/17119
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How to prevent handleFastifyError.handleFastifyError errors in Sentry?","articleBody":"### Problem Statement\n\nIn my route handles, I throw `Response` objects like:\n\n```\nthrow Response.json(\n {\n error: {\n code,\n details,\n id: sentryErrorForeignId,\n message,\n },\n } satisfies ApiErrorResponse,\n {\n headers,\n status,\n },\n );\n``` \n\nIt works as expected with Fastify, but the problem is that Sentry is catching these as if they are errors.\n\nI get lots of these issues, like:\n\n```\nhandleFastifyError.handleFastifyError\nLevel: Error\n[object Response]\nGET /api/gateway/v1/models\n```\n\nwith this stack trace:\n\n```\n… es/.pnpm/@sentry+node@9.40.0/node_modules/@sentry/node/src/integrations/tracing/fastify/index.ts in handleFastifyError.handleFastifyError at line 87:5\n… es/.pnpm/@sentry+node@9.40.0/node_modules/@sentry/node/src/integrations/tracing/fastify/index.ts in \u003canonymous> at line 123:24\nnode:diagnostics_channel in Channel.publish at line 150:9\n/srv/node_modules/.pnpm/fastify@5.4.0/node_modules/fastify/lib/wrapThenable.js at line 55:22\n\nnode:internal/process/task_queues in process.processTicksAndRejections at line 105:5\n```\n\nhttps://glama.sentry.io/issues/6760827050/?project=4507975514849280&query=is%3Aunresolved&referrer=issue-stream\n\nI am already returning `false` from `shouldHandleError`:\n\n```\nsetupFastifyErrorHandler(app, {\n shouldHandleError: () => {\n // We are handling errors ourselves.\n // We are only using `setupFastifyErrorHandler` to setup request isolation context.\n return false;\n },\n });\n\n app.setErrorHandler((error, request, reply) => {\n return replyWithErrorPage({ error, origin: 'setErrorHandler', reply });\n });\n```\n\n### Solution Brainstorm\n\nCome to think about it, this is likely a bug.\n\nOr maybe the ask is that at the moment `setupFastifyErrorHandler` is overloaded with error handling logic and also logic for starting a context for every request. It would be nice to separate out those two.","author":{"url":"https://github.com/punkpeye","@type":"Person","name":"punkpeye"},"datePublished":"2025-07-22T07:32:53Z","url":"https://github.com/getsentry/sentry-javascript/issues/17119"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:301bb3fd-fbb3-26a7-bdaa-7b802772c34f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B9FE:2B7A86:8A385:B8C62:6B05E728 |
| html-safe-nonce | abf3b0e2db80e48553a759e32fed5e6aac28313e205933e3fbe626e99755cd04 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUZFOjJCN0E4Njo4QTM4NTpCOEM2Mjo2QjA1RTcyOCIsInZpc2l0b3JfaWQiOiI4OTQ1OTI0NzA2MTc2MTk4NDQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 47777348f31f93c190fbebae464c3fe13bac1d7ee6263902a917cfe43482a978 |
| hovercard-subject-tag | issue:3251475928 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/17119/issue_layout |
| twitter:image | https://opengraph.githubassets.com/99388a207fb9152764dfafa338ccbff6c9f69d4f5c40897dd1da53aadf0004d4/getsentry/sentry-javascript/issues/17119 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/99388a207fb9152764dfafa338ccbff6c9f69d4f5c40897dd1da53aadf0004d4/getsentry/sentry-javascript/issues/17119 |
| og:image:alt | Problem Statement In my route handles, I throw Response objects like: throw Response.json( { error: { code, details, id: sentryErrorForeignId, message, }, } satisfies ApiErrorResponse, { headers, s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | punkpeye |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e6b0e6e5a9a8e0ddb968297ede4e2eac72d30ea174a0970eb8f22d6958e91e3 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 023691d14ad20c90d3ee61b0a0977b17dc6b6361 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width