fix(nextjs): Prevent wrong culprit from showing up for clientside error events #15475
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.