Description
In #16657 we got some user feedback that our consoleLoggingIntegration was sending logs with [Object Object] and [Array]. This was because of how we serialize with the safeJoin utility, since it uses String(value).
|
export function safeJoin(input: unknown[], delimiter?: string): string { |
|
if (!Array.isArray(input)) { |
|
return ''; |
|
} |
|
|
|
const output = []; |
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of |
|
for (let i = 0; i < input.length; i++) { |
|
const value = input[i]; |
|
try { |
|
// This is a hack to fix a Vue3-specific bug that causes an infinite loop of |
|
// console warnings. This happens when a Vue template is rendered with |
|
// an undeclared variable, which we try to stringify, ultimately causing |
|
// Vue to issue another warning which repeats indefinitely. |
|
// see: https://github.com/getsentry/sentry-javascript/pull/8981 |
|
if (isVueViewModel(value)) { |
|
output.push('[VueViewModel]'); |
|
} else { |
|
output.push(String(value)); |
|
} |
|
} catch (e) { |
|
output.push('[value cannot be serialized]'); |
|
} |
|
} |
|
|
|
return output.join(delimiter); |
|
} |
|
output.push(String(value)); |
This was fixed in #16658 by removing the usage of the safeJoin utility.
We should re-evaluate safeJoin usage across the SDKs and see if we want to replace it with JSON.stringify(normalize) instead.
Description
In #16657 we got some user feedback that our
consoleLoggingIntegrationwas sending logs with[Object Object]and[Array]. This was because of how we serialize with thesafeJoinutility, since it usesString(value).sentry-javascript/packages/core/src/utils/string.ts
Lines 68 to 94 in b94f652
sentry-javascript/packages/core/src/utils/string.ts
Line 86 in b94f652
This was fixed in #16658 by removing the usage of the
safeJoinutility.We should re-evaluate
safeJoinusage across the SDKs and see if we want to replace it withJSON.stringify(normalize)instead.