Skip to content

Commit 3fa7ccf

Browse files
committed
add debug warning for fetch api
1 parent 1db659f commit 3fa7ccf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

MIGRATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ to access and mutate the current scope.
9090

9191
`@sentry/hub` has been removed. All exports from `@sentry.hub` should be available in `@sentry/core`.
9292

93+
## Removal of `makeXHRTransport` transport (#10703)
94+
95+
The `makeXHRTransport` transport has been removed. Only `makeFetchTransport` is available now. This means that the Sentry SDK requires the fetch API to be available in the environment.
96+
9397
## General API Changes
9498

9599
- The minumum supported Node version for all the SDK packages is Node 14 (#10527)

packages/browser/src/sdk.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ import {
99
startSession,
1010
} from '@sentry/core';
1111
import type { DsnLike, Integration, Options, UserFeedback } from '@sentry/types';
12-
import { addHistoryInstrumentationHandler, logger, stackParserFromStackParserOptions } from '@sentry/utils';
12+
import {
13+
addHistoryInstrumentationHandler,
14+
logger,
15+
stackParserFromStackParserOptions,
16+
supportsFetch,
17+
} from '@sentry/utils';
1318

1419
import type { BrowserClientOptions, BrowserOptions } from './client';
1520
import { BrowserClient } from './client';
@@ -111,6 +116,13 @@ export function init(options: BrowserOptions = {}): void {
111116
options.sendClientReports = true;
112117
}
113118

119+
if (DEBUG_BUILD) {
120+
if (!supportsFetch()) {
121+
logger.warn(
122+
'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',
123+
);
124+
}
125+
}
114126
const clientOptions: BrowserClientOptions = {
115127
...options,
116128
stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),

0 commit comments

Comments
 (0)