Skip to content

Commit a47e98d

Browse files
committed
add debug warning for fetch api
1 parent fb78b45 commit a47e98d

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';
@@ -118,6 +123,13 @@ export function init(options: BrowserOptions = {}): void {
118123
options.sendClientReports = true;
119124
}
120125

126+
if (DEBUG_BUILD) {
127+
if (!supportsFetch()) {
128+
logger.warn(
129+
'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',
130+
);
131+
}
132+
}
121133
const clientOptions: BrowserClientOptions = {
122134
...options,
123135
stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),

0 commit comments

Comments
 (0)