-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(core)!: Pass root spans to beforeSendSpan and disallow returning null
#14831
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
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally looks good to me and I think the conversion is correct. Before we merge this, let's please add a sentence to the PR description why we went with this approach instead of calling beforeSendSpan earlier for posterity.
| }; | ||
| } | ||
| return beforeSendTransaction(event, hint); | ||
| return beforeSendTransaction(processedEvent as TransactionEvent, hint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l (not blocking): Is there a way we can get rid of this type cast? No worries if not, just curious since there's the isTransactionEvent check above 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah somehow no matter what I do, after the merge call ts thinks it's an event again, even if I do
processedEvent = merge<TransactionEvent>(
processedEvent,
convertSpanJsonToTransactionEvent(processedRootSpanJson),
);Docs follow-up for this PR: #14831 --------- Co-authored-by: Francesco Gringl-Novy <francesco.novy@sentry.io>
## Problem Next.js 15.4.6 build failing with: ``` Error: <Html> should not be imported outside of pages/_document Error occurred prerendering page "/404" ``` ## Root Cause Sentry's integration with Next.js 15 App Router causes conflicts when attempting to generate default error pages (/404, /_error). The Sentry instrumentation injects code that references Pages Router components in an App Router project. ## Changes - Disabled Sentry configuration files (renamed to .disabled) - Commented out Sentry imports in error.tsx and global-error.tsx - Disabled Sentry in instrumentation.ts - Created proper not-found.tsx for App Router - Fixed incorrect import in calculate-age-values route (@/lib/prisma -> @/lib/db) - Moved skipMiddlewareUrlNormalize and skipTrailingSlashRedirect to root config ## Workaround Sentry temporarily disabled until: 1. Sentry releases Next.js 15 compatible version, OR 2. Next.js fixes default error page generation in App Router Error tracking now uses console.error() instead of Sentry. ## Note This is a known issue: getsentry/sentry-javascript#14831 To re-enable Sentry: 1. Rename sentry.*.config.ts.disabled files back to .ts 2. Uncomment Sentry imports in error.tsx, global-error.tsx, instrumentation.ts 3. Re-enable withSentryConfig in next.config.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
beforeSendSpanbeforeSendSpanLooked at two options for passing the root span:
SentrySpanclass, before converting the root span into a transaction.SpanJSONout of an event and then writing back the updated values into the event.Went with (2), passing the root span within
processBeforeSendto have all processing hooks centrally in one place and because the other approach would have been too messy.closes #14336