Skip to content

Commit b9c9cc0

Browse files
committed
warn on double-init
1 parent eac96b6 commit b9c9cc0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/nuxt/src/runtime/utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ export function extractErrorContext(errorContext: CapturedErrorContext | undefin
4444
export function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head'], traceData?: SerializedTraceData): void {
4545
const metaTags = getTraceMetaTags(traceData);
4646

47+
if (head.some(tag => tag.includes('meta') && tag.includes('sentry-trace'))) {
48+
logger.warn(
49+
'Skipping addition of meta tags. Sentry tracing meta tags are already present in HTML page. Make sure to only set up Sentry once on the server-side. ',
50+
);
51+
return;
52+
}
53+
4754
if (metaTags) {
4855
logger.log('Adding Sentry tracing meta tags to HTML page:', metaTags);
4956
head.push(metaTags);

0 commit comments

Comments
 (0)