Skip to content

feat(node): Use diagnostics channel for Fastify v5 error handling #16715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

onurtemizkan
Copy link
Collaborator

Resolves: #15936

Copy link
Contributor

github-actions bot commented Jun 24, 2025

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 23.99 kB - -
@sentry/browser - with treeshaking flags 23.76 kB - -
@sentry/browser (incl. Tracing) 38.84 kB - -
@sentry/browser (incl. Tracing, Replay) 76.98 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.07 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 81.74 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 93.83 kB - -
@sentry/browser (incl. Feedback) 40.74 kB - -
@sentry/browser (incl. sendFeedback) 28.7 kB - -
@sentry/browser (incl. FeedbackAsync) 33.59 kB - -
@sentry/react 25.76 kB - -
@sentry/react (incl. Tracing) 40.84 kB - -
@sentry/vue 28.36 kB - -
@sentry/vue (incl. Tracing) 40.7 kB - -
@sentry/svelte 24.01 kB - -
CDN Bundle 25.5 kB - -
CDN Bundle (incl. Tracing) 38.92 kB - -
CDN Bundle (incl. Tracing, Replay) 74.83 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 80.29 kB - -
CDN Bundle - uncompressed 74.5 kB - -
CDN Bundle (incl. Tracing) - uncompressed 115.42 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 229.47 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 242.3 kB - -
@sentry/nextjs (client) 42.47 kB - -
@sentry/sveltekit (client) 39.33 kB - -
@sentry/node 150.96 kB +0.06% +84 B 🔺
@sentry/node - without tracing 98.64 kB +0.01% +1 B 🔺
@sentry/aws-serverless 124.4 kB -0.01% -1 B 🔽

View base workflow run

@onurtemizkan onurtemizkan force-pushed the onur/fastify-diag-error-handling branch from 53d3aac to 134bf84 Compare June 24, 2025 10:41
}
});

if (fastify.version?.startsWith('5.')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break for > v5!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional, just in case Fastify v6 uses a different diagnostics channel hook for errors when published. It won't break if 6.x is used here, in the worst scenario, the error will be captured twice, and deduped eventually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we check if our tracing:fastify.request.handler:error diagnostics channel listener was registered, that feels like a more robust check.

I guess this is hard because others can also register on tracing:fastify.request.handler:error. Perhaps we can do this by setting a field on the integration? Then you can grab the current client fastify integration instance and check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic error handler setup for Fastify v5
3 participants