Skip to content
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

fix(nextjs): Prevent wrong culprit from showing up for clientside error events #15475

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

lforst
Copy link
Member

@lforst lforst commented Feb 24, 2025

We're seeing a weird issue where error events have the wrong culprit containing incomplete-app-router-transaction.

My suspicion os that a transaction is started, then an error happens in between of the transaction being started and the transaction name being updated, and it thus receives the wrong culprit.

We fix this by not starting the transaction with a wrong name in the first place. I dunno why I didn't do this from the beginning.

I didn't fully verify this but it would be the only explanation I can come up with and I think it is nicer this way in any case.

Note that I even saw this happening with router.push transactions where we don't go into the branch where we don't update the name so it's not related to that code path.

@lforst lforst requested a review from chargome February 24, 2025 15:55
Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Ok we need to stop working on the same issues in parallel 😂

What I found so far that this is mainly an issue on safari mobile (could e.g. be a failing preflight request) and we only filter on this transaction name for type "transaction"

So I guess we can also remove the event processor with this pr!

ref #15411

@lforst
Copy link
Member Author

lforst commented Feb 24, 2025

Oh whoops, I zoned out in the meeting and thought you were talking about not-found errors or something because I heard event processor and forgot that we had the one for transactions. My bad!

I wouldn't remove the transaction event processor because it serves a different purpose than this fix. This fix is about making sure errors receive the right culprit, the processor is about dropping transactions for dropping transactions that never receive the popevent call - for example when the router.pop is called but the actual navigation never completes and the popevent isn't fired.

@chargome
Copy link
Member

Ah yeah I missed that this can still be the case then. Should we then adapt the processor to maybe fallback to the path whenever we face an error event with this tx name?

@lforst
Copy link
Member Author

lforst commented Feb 25, 2025

Should we then adapt the processor to maybe fallback to the path whenever we face an error event with this tx name?

Considering this is an invariant that should never happen in the first place I'd rather have it show up and cause people to ask questions rather than hide it behind "wrong" data.

@lforst lforst merged commit 02a709f into develop Feb 25, 2025
46 checks passed
@lforst lforst deleted the lforst-fix-transaction-name-for-errors branch February 25, 2025 07:43
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.

3 participants