Skip to content

Commit 6309dd6

Browse files
authored
fix(vue): Cast name parameter to string (#4483)
Vue router allows for the use of Symbol as the name parameter when registering routes. To prevent errors, we cast the name parameter to be a string as the transaction name must be a string.
1 parent 6d0bce9 commit 6309dd6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/ember/addon/instance-initializers/sentry-performance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function _instrumentEmberRouter(
8888
});
8989
}
9090

91-
const finishActiveTransaction = function(_: any, nextInstance: any) {
91+
const finishActiveTransaction = function (_: any, nextInstance: any) {
9292
if (nextInstance) {
9393
return;
9494
}

packages/vue/src/router.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export function vueRouterInstrumentation(router: VueRouter): VueRouterInstrument
5353

5454
if (startTransactionOnPageLoad && isPageLoadNavigation) {
5555
startTransaction({
56-
name: to.name || to.path,
56+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
57+
name: to.name.toString() || to.path,
5758
op: 'pageload',
5859
tags,
5960
data,
@@ -63,7 +64,7 @@ export function vueRouterInstrumentation(router: VueRouter): VueRouterInstrument
6364
if (startTransactionOnLocationChange && !isPageLoadNavigation) {
6465
startTransaction({
6566
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
66-
name: to.name || (to.matched[0] && to.matched[0].path) || to.path,
67+
name: to.name.toString() || (to.matched[0] && to.matched[0].path) || to.path,
6768
op: 'navigation',
6869
tags,
6970
data,

0 commit comments

Comments
 (0)