Skip to content

Commit 38e1b89

Browse files
committed
do not use subdomain
1 parent 46e4ded commit 38e1b89

File tree

2 files changed

+4
-7
lines changed
  • dev-packages/browser-integration-tests/suites/errors/fetch
  • packages/core/src/utils-hoist/instrument

2 files changed

+4
-7
lines changed

dev-packages/browser-integration-tests/suites/errors/fetch/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ sentryTest('handles fetch network errors on subdomains @firefox', async ({ getLo
3939
const eventData = envelopeRequestParser(await reqPromise);
4040

4141
const errorMap: Record<string, string> = {
42-
chromium: 'Failed to fetch (sentry-test-external.io)',
43-
webkit: 'Load failed (sentry-test-external.io)',
44-
firefox: 'NetworkError when attempting to fetch resource. (sentry-test-external.io)',
42+
chromium: 'Failed to fetch (subdomain.sentry-test-external.io)',
43+
webkit: 'Load failed (subdomain.sentry-test-external.io)',
44+
firefox: 'NetworkError when attempting to fetch resource. (subdomain.sentry-test-external.io)',
4545
};
4646

4747
const error = errorMap[browserName];

packages/core/src/utils-hoist/instrument/fetch.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ function instrumentFetch(onFetchResolved?: (response: Response) => void, skipNat
120120
) {
121121
try {
122122
const url = new URL(handlerData.fetchData.url);
123-
// We only want to take the top-level domain, e.g. xxx.sentry.io should become sentry.io
124-
// We do this to avoid noise when there may be dynamic subdomains
125-
const host = url.host.split('.').slice(-2).join('.');
126-
error.message = `${error.message} (${host})`;
123+
error.message = `${error.message} (${url.host})`;
127124
} catch {
128125
// ignore it if errors happen here
129126
}

0 commit comments

Comments
 (0)