Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/instrumentation-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Sentry.init({
environment,
release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,

// GTM이 Dynatrace RUM 태그를 실행할 때 dtrum 스크립트가 없으면 발생하는 서드파티 에러
ignoreErrors: [/dtrum is not defined/],

Comment on lines +12 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

ignoreErrors 패턴이 너무 좁아 동일 원인 에러가 일부 남을 수 있습니다.

현재 정규식 하나만으로는 브라우저별 메시지 변형(예: Safari 계열)을 놓쳐 Sentry 노이즈가 계속 발생할 수 있습니다.

확장 예시
-  ignoreErrors: [/dtrum is not defined/],
+  ignoreErrors: [
+    /dtrum is not defined/i,
+    /can't find variable:\s*dtrum/i,
+    /\bdtrum\b.*\bundefined\b/i,
+  ],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// GTM이 Dynatrace RUM 태그를 실행할 때 dtrum 스크립트가 없으면 발생하는 서드파티 에러
ignoreErrors: [/dtrum is not defined/],
// GTM이 Dynatrace RUM 태그를 실행할 때 dtrum 스크립트가 없으면 발생하는 서드파티 에러
ignoreErrors: [
/dtrum is not defined/i,
/can't find variable:\s*dtrum/i,
/\bdtrum\b.*\bundefined\b/i,
],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/instrumentation-client.ts` around lines 12 - 14, The ignoreErrors regex
pattern for dtrum errors is too narrow and doesn't account for browser-specific
variations in error messages (such as Safari variants), causing Sentry to still
capture these errors. Broaden the regex pattern in the ignoreErrors array to
match multiple variations of the dtrum error message that might occur across
different browsers, ensuring that all common variants of the same underlying
error are caught and filtered appropriately.

beforeSend(event, hint) {
const error = hint.originalException;

Expand Down
8 changes: 8 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ export default function Document() {
return (
<Html lang="ko">
<Head>
{/*
* GTM에 Dynatrace 태그가 구성되어 있으나 Dynatrace RUM 스크립트가 로드되지 않으면
* `ReferenceError: dtrum is not defined`가 발생한다. GTM보다 먼저 실행되는
* 이 stub으로 전역 참조 오류를 방지한다.
*/}
{/* eslint-disable-next-line react/no-danger */}
<script dangerouslySetInnerHTML={{ __html: 'window.dtrum=window.dtrum||{}' }} />

<link rel="preconnect" href="https://static.koreatech.in" crossOrigin="anonymous" />

{/* 기본 메타 (페이지 단위 메타는 components/seo/Seo 가 처리) */}
Expand Down
Loading