Skip to content
Merged
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
5 changes: 0 additions & 5 deletions packages/browser/src/integrations/httpclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
getClient,
GLOBAL_OBJ,
isSentryRequestUrl,
supportsNativeFetch,
} from '@sentry/core/browser';
import type { SentryWrappedXMLHttpRequest } from '@sentry/browser-utils';
import { addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils';
Expand Down Expand Up @@ -282,10 +281,6 @@ function _isInGivenStatusRanges(
* Wraps `fetch` function to capture request and response data
*/
function _wrapFetch(client: Client, options: HttpClientOptions): void {
if (!supportsNativeFetch()) {
return;
}

addFetchInstrumentationHandler(handlerData => {
Comment thread
sentry[bot] marked this conversation as resolved.
if (getClient() !== client) {
return;
Expand Down
1 change: 0 additions & 1 deletion packages/browser/test/integrations/httpclient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('httpClientIntegration', () => {
const client = new BrowserClient(getDefaultBrowserClientOptions(options));

vi.spyOn(SentryCore, 'getClient').mockReturnValue(client);
vi.spyOn(SentryCore, 'supportsNativeFetch').mockReturnValue(true);
const addFetchSpy = vi
.spyOn(SentryCore, 'addFetchInstrumentationHandler')
.mockImplementation(() => () => undefined);
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/browser-exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ export {

export { startIdleSpan } from './tracing/idleSpan';

export { supportsNativeFetch } from './utils/supports';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Public API removed without deprecation

Medium Severity

This was flagged because the review rules call out removal of publicly exported functions without a deprecation notice. supportsNativeFetch was a public export from @sentry/core and @sentry/core/browser with no @hidden or @deprecated tag. Similar helpers such as supportsFetch stay exported as deprecated, and the v11 migration guide does not list this removal.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 1c482b3. Configure here.

export type { XhrBreadcrumbData, XhrBreadcrumbHint } from './types/breadcrumb';
export type { BrowserClientReplayOptions } from './types/browseroptions';
Comment on lines 15 to 17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The removal of supportsNativeFetch from public exports in @sentry/core/browser will break a test in httpclient.test.ts that spies on this function.
Severity: HIGH

Suggested Fix

Update the test in packages/browser/test/integrations/httpclient.test.ts. Either import supportsNativeFetch directly from its source file (../utils/supports) for mocking, or refactor the test to no longer depend on this removed public export.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/core/src/browser-exports.ts#L15-L19

Potential issue: The function `supportsNativeFetch` has been removed from the public
exports in `packages/core/src/browser-exports.ts`. However, the test file
`packages/browser/test/integrations/httpclient.test.ts` still imports it from
`@sentry/core/browser` and attempts to create a spy on it using `vi.spyOn(SentryCore,
'supportsNativeFetch')`. After this change, `SentryCore.supportsNativeFetch` will be
`undefined`, causing the spy to fail and breaking the test suite. While internal usage
is unaffected, the test represents a consumer of the public API that will now fail.

Also affects:

  • packages/browser/test/integrations/httpclient.test.ts

Loading