diff --git a/static/app/bootstrap/initializeSdk.tsx b/static/app/bootstrap/initializeSdk.tsx index f51a4b58835f36..478b751b34c353 100644 --- a/static/app/bootstrap/initializeSdk.tsx +++ b/static/app/bootstrap/initializeSdk.tsx @@ -134,7 +134,10 @@ export function initializeSdk(config: Config) { if (event.transaction) { event.transaction = normalizeUrl(event.transaction, {forceCustomerDomain: true}); + + event.transaction = stripDoubleLeadingSlash(event.transaction); } + return event; }, @@ -181,6 +184,10 @@ export function initializeSdk(config: Config) { addEndpointTagToRequestError(event); lastEventId = event.event_id || hint.event_id; + if (event.transaction) { + event.transaction = stripDoubleLeadingSlash(event.transaction); + } + return event; }, }); @@ -329,3 +336,12 @@ export function addEndpointTagToRequestError(event: Event): void { event.tags = {...event.tags, endpoint: messageMatch[1]}; } } + +/** Due to an unplesant interaction of the React Router 6 integration and our React Router 6 shims, some transaction names get prepended with a double slash. e.g., "//dashboard/:dashboardId/widget/:widgetIndex/edit/" Will hopefully be resolved in an upcoming version of the SDK, or improved when we remove the routing shims. For now, manually cover this case by removing the first slash of two. */ +function stripDoubleLeadingSlash(transactionName: string) { + if (transactionName.startsWith('//')) { + return transactionName.substring(1); + } + + return transactionName; +}