Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ jobs:
echo "OK: scripts/sentry-xcode.sh executable"

job_type_check:
name: Type Check Typescript 3.8
name: Type Check Typescript 5.0
runs-on: ubuntu-latest
needs: [job_build, diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@babel/preset-env": "^7.25.3",
"@babel/preset-typescript": "^7.18.6",
"@sentry/core": "10.73.0",
"@sentry/core": "11.0.0-beta.1",
"@sentry/react-native": "8.25.0",
"@types/node": "^20.9.3",
"@types/react": "^19.1.4",
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/type-check/run-type-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cd "${__dirpath}/../../packages/core"

yalc publish

cd "${__dirpath}/ts3.8-test"
cd "${__dirpath}/ts5.0-test"

# Add yalc packages (creates .yalc/ directory and updates package.json)
yalc add @sentry/expo-upload-sourcemaps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "sentry-react-native-ts-3-8-test",
"name": "sentry-react-native-ts-5-0-test",
"version": "0.0.0",
"private": true,
"description": "Sentry React Native TypeScript 3.8 Test",
"description": "Sentry React Native TypeScript 5.0 Test",
"main": "index.ts",
"scripts": {
"type-check": "tsc --project tsconfig.build.json"
Expand All @@ -11,7 +11,7 @@
"devDependencies": {
"@types/react": "17.0.83",
"@types/react-native": "0.65.30",
"typescript": "3.8.3"
"typescript": "5.0.4"
},
"dependencies": {
"@sentry/expo-upload-sourcemaps": "file:.yalc/@sentry/expo-upload-sourcemaps",
Expand Down
70 changes: 2 additions & 68 deletions packages/core/etc/sentry-react-native.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,51 @@
import { addConsoleInstrumentationFilter } from '@sentry/core';
import { addEventProcessor } from '@sentry/core';
import { addIntegration } from '@sentry/core';
import { AnthropicAiClient } from '@sentry/core';
import { AnthropicAiInstrumentedMethod } from '@sentry/core';
import { AnthropicAiOptions } from '@sentry/core';
import { AnthropicAiResponse } from '@sentry/core';
import { Breadcrumb } from '@sentry/core';
import { browserApiErrorsIntegration } from '@sentry/react';
import { globalHandlersIntegration as browserGlobalHandlersIntegration } from '@sentry/react';
import { linkedErrorsIntegration as browserLinkedErrorsIntegration } from '@sentry/react';
import type { BrowserOptions } from '@sentry/react';
import type { CaptureContext } from '@sentry/core';
import { captureEvent } from '@sentry/core';
import { captureException } from '@sentry/core';
import { captureFeedback } from '@sentry/core';
import { captureMessage } from '@sentry/core';
import { Client } from '@sentry/core';
import type { ClientOptions } from '@sentry/core';
import { CompiledGraph } from '@sentry/core';
import { consoleLoggingIntegration } from '@sentry/browser';
import { consoleSandbox } from '@sentry/core';
import { createLangChainCallbackHandler } from '@sentry/core';
import { createReduxEnhancer } from '@sentry/react';
import { dedupeIntegration } from '@sentry/react';
import type { Envelope } from '@sentry/core';
import { ErrorBoundary } from '@sentry/react';
import type { ErrorBoundaryProps } from '@sentry/react';
import { ErrorEvent } from '@sentry/core';
import { Event as Event_2 } from '@sentry/core';
import type { EventHint } from '@sentry/core';
import { Exception } from '@sentry/core';
import { extraErrorDataIntegration } from '@sentry/react';
import { FeatureFlagsIntegration } from '@sentry/browser';
import type { FeedbackFormData } from '@sentry/core';
import { functionToStringIntegration } from '@sentry/react';
import { getActiveSpan } from '@sentry/core';
import { getClient } from '@sentry/core';
import { getCurrentScope } from '@sentry/core';
import { getGlobalScope } from '@sentry/core';
import { getIsolationScope } from '@sentry/core';
import { getRootSpan } from '@sentry/core';
import { GoogleGenAIChat } from '@sentry/core';
import { GoogleGenAIClient } from '@sentry/core';
import { GoogleGenAIOptions } from '@sentry/core';
import type { HostComponent } from 'react-native';
import { httpClientIntegration } from '@sentry/react';
import { httpContextIntegration } from '@sentry/react';
import type { ImageStyle } from 'react-native';
import { inboundFiltersIntegration } from '@sentry/react';
import { instrumentAnthropicAiClient } from '@sentry/core';
import { InstrumentedMethod } from '@sentry/core';
import { instrumentGoogleGenAIClient } from '@sentry/core';
import { instrumentLangGraph } from '@sentry/core';
import { instrumentOpenAiClient } from '@sentry/core';
import { instrumentStateGraph } from '@sentry/core';
import { instrumentStateGraphCompile } from '@sentry/core';
import { eventFiltersIntegration as inboundFiltersIntegration } from '@sentry/react';
import { Integration } from '@sentry/core';
import { LangChainIntegration } from '@sentry/core';
import { LangChainOptions } from '@sentry/core';
import { LangGraphIntegration } from '@sentry/core';
import { LangGraphOptions } from '@sentry/core';
import { lastEventId } from '@sentry/core';
import { logger } from '@sentry/browser';
import type { makeFetchTransport } from '@sentry/browser';
import { Metric } from '@sentry/core';
import { metrics } from '@sentry/browser';
import { OpenAiClient } from '@sentry/core';
import { OpenAiOptions } from '@sentry/core';
import type { Options } from '@sentry/core';

Check warning on line 55 in packages/core/etc/sentry-react-native.api.md

View check run for this annotation

@sentry/warden / warden: code-review

Removing previously exported AI helpers breaks React Native consumers

The v11 compatibility changes remove the OpenAI, Anthropic, Google GenAI, LangChain, and LangGraph helpers from the `@sentry/react-native` public entry point. Apps that imported these helpers from React Native will fail to compile after upgrading. Before a releasable v11 release, document whether React Native users should install and import an alternative package or confirm that these helpers are unsupported on React Native.
Comment on lines 11 to 55

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.

Removing previously exported AI helpers breaks React Native consumers

The v11 compatibility changes remove the OpenAI, Anthropic, Google GenAI, LangChain, and LangGraph helpers from the @sentry/react-native public entry point. Apps that imported these helpers from React Native will fail to compile after upgrading. Before a releasable v11 release, document whether React Native users should install and import an alternative package or confirm that these helpers are unsupported on React Native.

Evidence
  • packages/core/src/js/index.ts no longer re-exports the AI instrumentation helpers or their types.
  • The entry point explicitly states that the helpers moved to server-only @sentry/server-utils, which is not a dependency of @sentry/react-native.
  • CHANGELOG.md previously documented these helpers as React Native exports in the 8.9.1 release under PR feat(ai): Re-export AI SDK manual instrumentation helpersย #6028.
  • No replacement React Native export or migration guidance is included for existing importers, so their imports will fail at compile time.
Also found at 4 additional locations
  • packages/core/etc/sentry-react-native.api.md:149-161
  • packages/core/etc/sentry-react-native.api.md:396-423
  • packages/core/etc/sentry-react-native.api.md:490-495
  • packages/core/src/js/index.ts:50-62

Identified by Warden ยท code-review ยท 84H-EYE

import { Profiler } from '@sentry/react';
import * as React_2 from 'react';
import { replayIntegration } from '@sentry/react';
Expand Down Expand Up @@ -126,14 +104,6 @@

export { addIntegration }

export { AnthropicAiClient }

export { AnthropicAiInstrumentedMethod }

export { AnthropicAiOptions }

export { AnthropicAiResponse }

// @public
export function appLoaded(): void;

Expand Down Expand Up @@ -176,23 +146,19 @@

export { captureMessage }

// @public
export function close(): Promise<void>;

export { CompiledGraph }

export { consoleLoggingIntegration }

export { consoleSandbox }

// @public
export function crashedLastRun(): Promise<boolean | null>;

export { createLangChainCallbackHandler }

// @public (undocumented)
export const createNativeFramesIntegrations: (enable: boolean | undefined) => Integration | undefined;

Check warning on line 161 in packages/core/etc/sentry-react-native.api.md

View check run for this annotation

@sentry/warden / warden: code-review

[84H-EYE] Removing previously exported AI helpers breaks React Native consumers (additional location)

The v11 compatibility changes remove the OpenAI, Anthropic, Google GenAI, LangChain, and LangGraph helpers from the `@sentry/react-native` public entry point. Apps that imported these helpers from React Native will fail to compile after upgrading. Before a releasable v11 release, document whether React Native users should install and import an alternative package or confirm that these helpers are unsupported on React Native.
// @public
export function createReactNativeRewriteFrames(): Integration;

Expand Down Expand Up @@ -427,62 +393,34 @@
// @public
export type GlobalErrorBoundaryProps = ErrorBoundaryProps & {
includeNonFatalGlobalErrors?: boolean;
includeUnhandledRejections?: boolean;
};

export { GoogleGenAIChat }

export { GoogleGenAIClient }

export { GoogleGenAIOptions }

// Warning: (ae-forgotten-export) The symbol "GraphQLReactNativeIntegrationOptions" needs to be exported by the entry point index.d.ts
//
// @public
export function graphqlIntegration(options: GraphQLReactNativeIntegrationOptions): Integration;

// Warning: (ae-forgotten-export) The symbol "HermesProfilingOptions" needs to be exported by the entry point index.d.ts
//
// @public
export const hermesProfilingIntegration: (initOptions?: HermesProfilingOptions) => Integration;

// @public @deprecated (undocumented)
export const hideFeedbackButton: () => void;

export { httpClientIntegration }

export { httpContextIntegration }

export { inboundFiltersIntegration }

// @public
export function init(passedOptions: ReactNativeOptions): void;

export { instrumentAnthropicAiClient }

export { InstrumentedMethod }

export { instrumentGoogleGenAIClient }

export { instrumentLangGraph }

export { instrumentOpenAiClient }

export { instrumentStateGraph }

export { instrumentStateGraphCompile }

export { LangChainIntegration }

export { LangChainOptions }

export { LangGraphIntegration }

export { LangGraphOptions }

export { lastEventId }

// @public (undocumented)

Check warning on line 423 in packages/core/etc/sentry-react-native.api.md

View check run for this annotation

@sentry/warden / warden: code-review

[84H-EYE] Removing previously exported AI helpers breaks React Native consumers (additional location)

The v11 compatibility changes remove the OpenAI, Anthropic, Google GenAI, LangChain, and LangGraph helpers from the `@sentry/react-native` public entry point. Apps that imported these helpers from React Native will fail to compile after upgrading. Before a releasable v11 release, document whether React Native users should install and import an alternative package or confirm that these helpers are unsupported on React Native.
export const logEnricherIntegration: () => Integration;

export { logger }
Expand Down Expand Up @@ -549,16 +487,12 @@
medium: FontStyle;
bold: FontStyle;
heavy: FontStyle;
};
}

export { OpenAiClient }

export { OpenAiOptions }

// @public
export function pauseAppHangTracking(): void;

Check warning on line 495 in packages/core/etc/sentry-react-native.api.md

View check run for this annotation

@sentry/warden / warden: code-review

[84H-EYE] Removing previously exported AI helpers breaks React Native consumers (additional location)

The v11 compatibility changes remove the OpenAI, Anthropic, Google GenAI, LangChain, and LangGraph helpers from the `@sentry/react-native` public entry point. Apps that imported these helpers from React Native will fail to compile after upgrading. Before a releasable v11 release, document whether React Native users should install and import an alternative package or confirm that these helpers are unsupported on React Native.
// @public
export function popTurboModuleCall(callId: number): void;

Expand Down Expand Up @@ -949,7 +883,7 @@
// src/js/feedback/integration.ts:21:5 - (ae-forgotten-export) The symbol "ScreenshotButtonProps" needs to be exported by the entry point index.d.ts
// src/js/feedback/integration.ts:23:5 - (ae-forgotten-export) The symbol "FeedbackFormTheme" needs to be exported by the entry point index.d.ts
// src/js/tracing/reactnativetracing.ts:90:3 - (ae-forgotten-export) The symbol "ReactNativeTracingState" needs to be exported by the entry point index.d.ts
// src/js/tracing/reactnavigation.ts:228:3 - (ae-forgotten-export) The symbol "RouteOverrideProvider" needs to be exported by the entry point index.d.ts
// src/js/tracing/reactnavigation.ts:229:3 - (ae-forgotten-export) The symbol "RouteOverrideProvider" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
"react-native": ">=0.65.0"
},
"dependencies": {
"@sentry/browser": "10.73.0",
"@sentry/bundler-plugins": "10.73.0",
"@sentry/browser": "11.0.0-beta.1",
"@sentry/bundler-plugins": "11.0.0-beta.1",
"@sentry/cli": "3.7.0",
"@sentry/core": "10.73.0",
"@sentry/core": "11.0.0-beta.1",
"@sentry/expo-upload-sourcemaps": "workspace:*",
"@sentry/react": "10.73.0"
"@sentry/react": "11.0.0-beta.1"
},
"devDependencies": {
"@babel/core": "^7.26.7",
Expand All @@ -87,8 +87,8 @@
"@mswjs/interceptors": "^0.25.15",
"@react-native/babel-preset": "0.87.1",
"@react-native/jest-preset": "0.87.1",
"@sentry/eslint-plugin-sdk": "10.73.0",
"@sentry/typescript": "10.73.0",
"@sentry/eslint-plugin-sdk": "11.0.0-beta.1",
"@sentry/typescript": "11.0.0-beta.1",
"@sentry/wizard": "7.0.3",
"@testing-library/react-native": "^13.2.2",
"@types/jest": "^29.5.13",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/js/feedback/FeedbackForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
const currentUser = {
useSentryUser: {
email: this.props?.useSentryUser?.email || this._getUser()?.email || '',
name: this.props?.useSentryUser?.name || this._getUser()?.name || '',
// `User.name` was removed from the typed interface in JS v11 (it now
// only exists via the `[key: string]: unknown` index signature), so
// narrow it back to the string it holds.
name: this.props?.useSentryUser?.name || (this._getUser()?.name as string | undefined) || '',
},
};

Expand Down
30 changes: 4 additions & 26 deletions packages/core/src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,19 @@
getIsolationScope,
getClient,
setCurrentClient,
addEventProcessor,
lastEventId,
consoleSandbox,
instrumentOpenAiClient,
instrumentAnthropicAiClient,
instrumentGoogleGenAIClient,
createLangChainCallbackHandler,
instrumentStateGraph,
instrumentStateGraphCompile,
addConsoleInstrumentationFilter,
} from '@sentry/core';

/** @deprecated Use `instrumentStateGraph` instead. `instrumentLangGraph` will be removed in a future major version. */
export { instrumentLangGraph } from '@sentry/core';

export type {
OpenAiClient,
OpenAiOptions,
InstrumentedMethod,
AnthropicAiClient,
AnthropicAiOptions,
AnthropicAiInstrumentedMethod,
AnthropicAiResponse,
GoogleGenAIClient,
GoogleGenAIChat,
GoogleGenAIOptions,
LangChainOptions,
LangChainIntegration,
LangGraphOptions,
LangGraphIntegration,
CompiledGraph,
} from '@sentry/core';
// NOTE: The AI instrumentation helpers (OpenAI, Anthropic, Google GenAI, LangChain,
// LangGraph) and their types were removed from `@sentry/core` in JS v11 and moved to
// the server-only `@sentry/server-utils` package, which React Native does not depend
// on. They are therefore no longer re-exported here.

export {
ErrorBoundary,

Check warning on line 62 in packages/core/src/js/index.ts

View check run for this annotation

@sentry/warden / warden: code-review

[84H-EYE] Removing previously exported AI helpers breaks React Native consumers (additional location)

The v11 compatibility changes remove the OpenAI, Anthropic, Google GenAI, LangChain, and LangGraph helpers from the `@sentry/react-native` public entry point. Apps that imported these helpers from React Native will fail to compile after upgrading. Before a releasable v11 release, document whether React Native users should install and import an alternative package or confirm that these helpers are unsupported on React Native.
withErrorBoundary,
createReduxEnhancer,
Profiler,
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/js/integrations/deeplink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { IntegrationFn } from '@sentry/core';

import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core';

import type { ReactNativeClientOptions } from '../options';
import type { DeepLinkSource } from '../tracing/pendingDeepLink';

import { setPendingDeepLink } from '../tracing/pendingDeepLink';
Expand Down Expand Up @@ -57,7 +58,7 @@ export function sanitizeDeepLinkUrl(url: string): string {
* When PII is disabled, query strings and ID-like path segments are removed.
*/
function getBreadcrumbUrl(url: string): string {
const sendDefaultPii = getClient()?.getOptions()?.sendDefaultPii ?? false;
const sendDefaultPii = (getClient()?.getOptions() as ReactNativeClientOptions | undefined)?.sendDefaultPii ?? false;
return sendDefaultPii ? url : sanitizeDeepLinkUrl(url);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/js/integrations/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export {
globalHandlersIntegration as browserGlobalHandlersIntegration,
httpClientIntegration,
httpContextIntegration,
inboundFiltersIntegration,
// `inboundFiltersIntegration` was renamed to `eventFiltersIntegration` in JS v11.
// Keep the existing public name to avoid breaking the SDK's own API surface.
eventFiltersIntegration as inboundFiltersIntegration,
linkedErrorsIntegration as browserLinkedErrorsIntegration,
rewriteFramesIntegration,
extraErrorDataIntegration,
Expand Down
21 changes: 13 additions & 8 deletions packages/core/src/js/integrations/nativelinkederrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,28 @@ function walkErrorTree(

let exception: Exception;
let exceptionDebugImages: DebugImage[] | undefined;
// `error[key]` is `unknown` since JS v11 tightened `ExtendedError`'s index
// signature from `any` to `unknown`; the branches below runtime-check its
// shape before narrowing, and cast to the concrete native shapes the helpers
// expect (this data originates untyped from the native layer).
if (isString(linkedError)) {
exception = {
value: linkedError,
};
} else if ('stackElements' in linkedError) {
} else if (isPlainObject(linkedError) && 'stackElements' in linkedError) {
// isJavaException
exception = exceptionFromJavaStackElements(linkedError);
} else if ('stackReturnAddresses' in linkedError) {
exception = exceptionFromJavaStackElements(linkedError as Parameters<typeof exceptionFromJavaStackElements>[0]);
} else if (isPlainObject(linkedError) && 'stackReturnAddresses' in linkedError) {
// isObjCException
const { appleException, appleDebugImages } = exceptionFromAppleStackReturnAddresses(linkedError);
const { appleException, appleDebugImages } = exceptionFromAppleStackReturnAddresses(
linkedError as Parameters<typeof exceptionFromAppleStackReturnAddresses>[0],
);
exception = appleException;
exceptionDebugImages = appleDebugImages;
} else if (isInstanceOf(linkedError, Error)) {
exception = exceptionFromError(parser, error[key]);
exception = exceptionFromError(parser, linkedError);
} else if (isPlainObject(linkedError)) {
// oxlint-disable-next-line typescript-eslint(no-unnecessary-type-assertion)
const plainError = linkedError as Record<string, unknown>;
const plainError = linkedError;
exception = {
type: typeof plainError.name === 'string' ? plainError.name : undefined,
value: typeof plainError.message === 'string' ? plainError.message : undefined,
Expand All @@ -122,7 +127,7 @@ function walkErrorTree(
return walkErrorTree(
parser,
limit,
linkedError,
linkedError as ExtendedError,
key,
[...exceptions, exception],
[...debugImages, ...(exceptionDebugImages || [])],
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/js/integrations/turboModuleContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* oxlint-disable eslint(max-lines) */
import type { Client, Event, Integration, Span, TransactionEvent } from '@sentry/core';

import { addBreadcrumb, debug, spanToJSON } from '@sentry/core';
import { addBreadcrumb, debug, spanToStaticSpanJSON } from '@sentry/core';

import {
addTurboModuleCallStartObserver,
Expand Down Expand Up @@ -439,7 +439,7 @@ function attachWindowToSpan(
window.writtenPerMethodKeys = nextKeys;

if (rows.length > topN) {
const spanId = spanToJSON(span).span_id;
const spanId = spanToStaticSpanJSON(span).span_id;
debug.log(
`[TurboModuleContext] Span ${spanId ?? '(unknown)'} touched ${rows.length} unique TurboModule methods, ` +
`truncated to top ${topN} by duration. Summary attributes still reflect the full totals.`,
Expand All @@ -448,7 +448,7 @@ function attachWindowToSpan(

span.setAttributes(attributes);

const spanId = spanToJSON(span).span_id;
const spanId = spanToStaticSpanJSON(span).span_id;
if (spanId) {
if (!pendingSpanAttributes.has(spanId) && pendingSpanAttributes.size >= MAX_PENDING_SPAN_ATTRIBUTES) {
const oldest = pendingSpanAttributes.keys().next().value;
Expand Down
11 changes: 11 additions & 0 deletions packages/core/src/js/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,17 @@ export interface BaseReactNativeOptions {
*/
propagateTraceparent?: boolean;

/**
* Enables sending log events to Sentry.
*
* On the JavaScript layer this used to be a `@sentry/core` option. As of JS SDK v11 the option
* was removed from core (logs are captured on-usage there), so the React Native SDK owns it to
* keep gating native log capture and its `logsOrigin` orchestration.
*
* @default false
*/
enableLogs?: boolean;

/**
* Controls which log origin is captured when `enableLogs` is set to true.
* 'all' will log all origins.
Expand Down
Loading
Loading