@sentry/react-native 5.17.0 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/RNSentry.podspec +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +2 -2
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +4 -3
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +6 -5
- package/dist/js/NativeRNSentry.d.ts +2 -2
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +21 -6
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +6 -0
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/index.d.ts +1 -0
- package/dist/js/integrations/index.d.ts.map +1 -1
- package/dist/js/integrations/index.js +1 -0
- package/dist/js/integrations/index.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.d.ts +6 -2
- package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +63 -72
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts +18 -0
- package/dist/js/integrations/spotlight.d.ts.map +1 -0
- package/dist/js/integrations/spotlight.js +84 -0
- package/dist/js/integrations/spotlight.js.map +1 -0
- package/dist/js/options.d.ts +19 -0
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +2 -0
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/utils/xhr.d.ts +20 -0
- package/dist/js/utils/xhr.d.ts.map +1 -0
- package/dist/js/utils/xhr.js +31 -0
- package/dist/js/utils/xhr.js.map +1 -0
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +2 -2
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +14 -18
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +5 -8
- package/package.json +6 -2
- package/scripts/expo-upload-sourcemaps.js +54 -12
- package/src/js/NativeRNSentry.ts +2 -2
- package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -2
- package/ts3.8/dist/js/integrations/index.d.ts +1 -0
- package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +6 -2
- package/ts3.8/dist/js/integrations/spotlight.d.ts +18 -0
- package/ts3.8/dist/js/options.d.ts +19 -0
- package/ts3.8/dist/js/utils/worldwide.d.ts +2 -0
- package/ts3.8/dist/js/utils/xhr.d.ts +20 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +2 -2
package/ios/RNSentry.mm
CHANGED
|
@@ -201,11 +201,10 @@ RCT_EXPORT_METHOD(fetchModules:(RCTPromiseResolveBlock)resolve
|
|
|
201
201
|
resolve(modulesString);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
204
|
+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, fetchNativePackageName)
|
|
206
205
|
{
|
|
207
206
|
NSString *packageName = [[NSBundle mainBundle] executablePath];
|
|
208
|
-
|
|
207
|
+
return packageName;
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
- (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAddr
|
|
@@ -273,12 +272,10 @@ RCT_EXPORT_METHOD(fetchNativePackageName:(RCTPromiseResolveBlock)resolve
|
|
|
273
272
|
}
|
|
274
273
|
}
|
|
275
274
|
|
|
276
|
-
|
|
277
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
278
|
-
reject:(RCTPromiseRejectBlock)reject)
|
|
275
|
+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, fetchNativeStackFramesBy:(NSArray *)instructionsAddr)
|
|
279
276
|
{
|
|
280
|
-
|
|
281
|
-
symbolicate:dladdr]
|
|
277
|
+
return [self fetchNativeStackFramesBy:instructionsAddr
|
|
278
|
+
symbolicate:dladdr];
|
|
282
279
|
}
|
|
283
280
|
|
|
284
281
|
RCT_EXPORT_METHOD(fetchNativeDeviceContexts:(RCTPromiseResolveBlock)resolve
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.18.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@babel/core": "^7.23.5",
|
|
80
80
|
"@expo/metro-config": "0.16.0",
|
|
81
|
+
"@mswjs/interceptors": "^0.25.15",
|
|
81
82
|
"@sentry-internal/eslint-config-sdk": "7.81.1",
|
|
82
83
|
"@sentry-internal/eslint-plugin-sdk": "7.81.1",
|
|
83
84
|
"@sentry-internal/typescript": "7.80.0",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"@types/react": "^18.2.14",
|
|
88
89
|
"@types/uglify-js": "^3.17.2",
|
|
89
90
|
"@types/uuid": "^9.0.4",
|
|
91
|
+
"@types/xmlhttprequest": "^1.8.2",
|
|
90
92
|
"babel-jest": "^29.6.2",
|
|
91
93
|
"downlevel-dts": "^0.11.0",
|
|
92
94
|
"eslint": "^7.6.0",
|
|
@@ -96,6 +98,7 @@
|
|
|
96
98
|
"expo-module-scripts": "^3.1.0",
|
|
97
99
|
"jest": "^29.6.2",
|
|
98
100
|
"jest-environment-jsdom": "^29.6.2",
|
|
101
|
+
"jest-extended": "^4.0.2",
|
|
99
102
|
"madge": "^6.1.0",
|
|
100
103
|
"metro": "0.76",
|
|
101
104
|
"prettier": "^2.0.5",
|
|
@@ -106,7 +109,8 @@
|
|
|
106
109
|
"ts-jest": "^29.1.1",
|
|
107
110
|
"typescript": "4.9.5",
|
|
108
111
|
"uglify-js": "^3.17.4",
|
|
109
|
-
"uuid": "^9.0.1"
|
|
112
|
+
"uuid": "^9.0.1",
|
|
113
|
+
"xmlhttprequest": "^1.8.0"
|
|
110
114
|
},
|
|
111
115
|
"rnpm": {
|
|
112
116
|
"commands": {},
|
|
@@ -4,8 +4,8 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const process = require('process');
|
|
6
6
|
|
|
7
|
+
const SENTRY_ORG = 'SENTRY_ORG';
|
|
7
8
|
const SENTRY_PROJECT = 'SENTRY_PROJECT';
|
|
8
|
-
// The sentry org is inferred from the auth token
|
|
9
9
|
const SENTRY_AUTH_TOKEN = 'SENTRY_AUTH_TOKEN';
|
|
10
10
|
const SENTRY_CLI_EXECUTABLE = 'SENTRY_CLI_EXECUTABLE';
|
|
11
11
|
|
|
@@ -101,25 +101,51 @@ function groupAssets(assetPaths) {
|
|
|
101
101
|
return groups;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
process.env.NODE_ENV = process.env.NODE_ENV || 'development'; // Ensures precedence .env.development > .env (the same as @expo/cli)
|
|
105
|
+
const projectRoot = '.'; // Assume script is run from the project root
|
|
106
|
+
try {
|
|
107
|
+
require('@expo/env').load(projectRoot);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.warn('⚠️ Failed to load environment variables using @expo/env.');
|
|
110
|
+
console.warn(error);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let sentryOrg = getEnvVar(SENTRY_ORG);
|
|
104
114
|
let sentryProject = getEnvVar(SENTRY_PROJECT);
|
|
105
115
|
let authToken = getEnvVar(SENTRY_AUTH_TOKEN);
|
|
106
116
|
const sentryCliBin = getEnvVar(SENTRY_CLI_EXECUTABLE) || require.resolve('@sentry/cli/bin/sentry-cli');
|
|
107
117
|
|
|
108
|
-
if (!sentryProject) {
|
|
109
|
-
console.log(
|
|
118
|
+
if (!sentryOrg || !sentryProject) {
|
|
119
|
+
console.log('🐕 Fetching from expo config...');
|
|
110
120
|
const pluginConfig = getSentryPluginPropertiesFromExpoConfig();
|
|
111
121
|
if (!pluginConfig) {
|
|
112
122
|
console.error("Could not fetch '@sentry/react-native' plugin properties from expo config.");
|
|
113
123
|
process.exit(1);
|
|
114
124
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
|
|
126
|
+
if (!sentryOrg) {
|
|
127
|
+
if (!pluginConfig.organization) {
|
|
128
|
+
console.error(
|
|
129
|
+
`Could not resolve sentry org, set it in the environment variable ${SENTRY_ORG} or in the '@sentry/react-native' plugin properties in your expo config.`,
|
|
130
|
+
);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
sentryOrg = pluginConfig.organization;
|
|
135
|
+
console.log(`${SENTRY_ORG} resolved to ${sentryOrg} from expo config.`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (!sentryProject) {
|
|
139
|
+
if (!pluginConfig.project) {
|
|
140
|
+
console.error(
|
|
141
|
+
`Could not resolve sentry project, set it in the environment variable ${SENTRY_PROJECT} or in the '@sentry/react-native' plugin properties in your expo config.`,
|
|
142
|
+
);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
sentryProject = pluginConfig.project;
|
|
147
|
+
console.log(`${SENTRY_PROJECT} resolved to ${sentryProject} from expo config.`);
|
|
120
148
|
}
|
|
121
|
-
sentryProject = pluginConfig.project;
|
|
122
|
-
console.log(`${SENTRY_PROJECT} resolved to ${sentryProject} from expo config.`);
|
|
123
149
|
}
|
|
124
150
|
|
|
125
151
|
if (!authToken) {
|
|
@@ -137,6 +163,8 @@ if (!outputDir) {
|
|
|
137
163
|
const files = getAssetPathsSync(outputDir);
|
|
138
164
|
const groupedAssets = groupAssets(files);
|
|
139
165
|
|
|
166
|
+
const totalAssets = Object.keys(groupedAssets).length;
|
|
167
|
+
let numAssetsUploaded = 0;
|
|
140
168
|
for (const [assetGroupName, assets] of Object.entries(groupedAssets)) {
|
|
141
169
|
const sourceMapPath = assets.find(asset => asset.endsWith('.map'));
|
|
142
170
|
if (sourceMapPath) {
|
|
@@ -145,16 +173,30 @@ for (const [assetGroupName, assets] of Object.entries(groupedAssets)) {
|
|
|
145
173
|
sourceMap.debug_id = sourceMap.debugId;
|
|
146
174
|
}
|
|
147
175
|
writeJSONFile(sourceMapPath, sourceMap);
|
|
176
|
+
console.log(`⬆️ Uploading ${assetGroupName} bundle and sourcemap...`);
|
|
177
|
+
} else {
|
|
178
|
+
console.log(`❓ Sourcemap for ${assetGroupName} not found, skipping...`);
|
|
179
|
+
continue;
|
|
148
180
|
}
|
|
149
|
-
|
|
181
|
+
|
|
150
182
|
const isHermes = assets.find(asset => asset.endsWith('.hbc'));
|
|
151
183
|
execSync(`${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, {
|
|
152
184
|
env: {
|
|
153
185
|
...process.env,
|
|
154
186
|
[SENTRY_PROJECT]: sentryProject,
|
|
187
|
+
[SENTRY_ORG]: sentryOrg,
|
|
155
188
|
},
|
|
156
189
|
stdio: 'inherit',
|
|
157
190
|
});
|
|
191
|
+
numAssetsUploaded++;
|
|
158
192
|
}
|
|
159
193
|
|
|
160
|
-
|
|
194
|
+
if (numAssetsUploaded === totalAssets) {
|
|
195
|
+
console.log('✅ Uploaded bundles and sourcemaps to Sentry successfully.');
|
|
196
|
+
} else {
|
|
197
|
+
console.warn(
|
|
198
|
+
`⚠️ Uploaded ${numAssetsUploaded} of ${totalAssets} bundles and sourcemaps. ${
|
|
199
|
+
numAssetsUploaded === 0 ? 'Ensure you are running `expo export` with the `--dump-sourcemap` flag.' : ''
|
|
200
|
+
}`,
|
|
201
|
+
);
|
|
202
|
+
}
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -34,8 +34,8 @@ export interface Spec extends TurboModule {
|
|
|
34
34
|
fetchViewHierarchy(): Promise<number[] | undefined | null>;
|
|
35
35
|
startProfiling(): { started?: boolean; error?: string };
|
|
36
36
|
stopProfiling(): { profile?: string; nativeProfile?: UnsafeObject; error?: string };
|
|
37
|
-
fetchNativePackageName():
|
|
38
|
-
fetchNativeStackFramesBy(instructionsAddr: number[]):
|
|
37
|
+
fetchNativePackageName(): string | undefined | null;
|
|
38
|
+
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export type NativeStackFrame = {
|
|
@@ -33,8 +33,8 @@ export interface Spec extends TurboModule {
|
|
|
33
33
|
nativeProfile?: UnsafeObject;
|
|
34
34
|
error?: string;
|
|
35
35
|
};
|
|
36
|
-
fetchNativePackageName():
|
|
37
|
-
fetchNativeStackFramesBy(instructionsAddr: number[]):
|
|
36
|
+
fetchNativePackageName(): string | undefined | null;
|
|
37
|
+
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;
|
|
38
38
|
}
|
|
39
39
|
export type NativeStackFrame = {
|
|
40
40
|
platform: string;
|
|
@@ -7,4 +7,5 @@ export { SdkInfo } from './sdkinfo';
|
|
|
7
7
|
export { ReactNativeInfo } from './reactnativeinfo';
|
|
8
8
|
export { ModulesLoader } from './modulesloader';
|
|
9
9
|
export { HermesProfiling } from '../profiling/integration';
|
|
10
|
+
export { Spotlight } from './spotlight';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EventProcessor, Hub, Integration } from '@sentry/types';
|
|
1
|
+
import type { Client, Event, EventHint, EventProcessor, Hub, Integration } from '@sentry/types';
|
|
2
2
|
interface LinkedErrorsOptions {
|
|
3
3
|
key: string;
|
|
4
4
|
limit: number;
|
|
@@ -25,7 +25,11 @@ export declare class NativeLinkedErrors implements Integration {
|
|
|
25
25
|
/**
|
|
26
26
|
* @inheritDoc
|
|
27
27
|
*/
|
|
28
|
-
setupOnce(
|
|
28
|
+
setupOnce(_addGlobalEventProcessor: (callback: EventProcessor) => void, _getCurrentHub: () => Hub): void;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
preprocessEvent(event: Event, hint: EventHint | undefined, client: Client): void;
|
|
29
33
|
/**
|
|
30
34
|
* Enriches passed event with linked exceptions and native debug meta images.
|
|
31
35
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Integration } from '@sentry/types';
|
|
2
|
+
type SpotlightReactNativeIntegrationOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* The URL of the Sidecar instance to connect and forward events to.
|
|
5
|
+
* If not set, Spotlight will try to connect to the Sidecar running on localhost:8969.
|
|
6
|
+
*
|
|
7
|
+
* @default "http://localhost:8969/stream"
|
|
8
|
+
*/
|
|
9
|
+
sidecarUrl?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Use this integration to send errors and transactions to Spotlight.
|
|
13
|
+
*
|
|
14
|
+
* Learn more about spotlight at https://spotlightjs.com
|
|
15
|
+
*/
|
|
16
|
+
export declare function Spotlight({ sidecarUrl, }?: SpotlightReactNativeIntegrationOptions): Integration;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=spotlight.d.ts.map
|
|
@@ -134,6 +134,25 @@ export interface BaseReactNativeOptions {
|
|
|
134
134
|
* @default false
|
|
135
135
|
*/
|
|
136
136
|
enableCaptureFailedRequests?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* This option will enable forwarding captured Sentry events to Spotlight.
|
|
139
|
+
*
|
|
140
|
+
* More details: https://spotlightjs.com/
|
|
141
|
+
*
|
|
142
|
+
* IMPORTANT: Only set this option to `true` while developing, not in production!
|
|
143
|
+
*/
|
|
144
|
+
enableSpotlight?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* This option changes the default Spotlight Sidecar URL.
|
|
147
|
+
*
|
|
148
|
+
* By default, the SDK expects the Sidecar to be running
|
|
149
|
+
* on the same host as React Native Metro Dev Server.
|
|
150
|
+
*
|
|
151
|
+
* More details: https://spotlightjs.com/
|
|
152
|
+
*
|
|
153
|
+
* @default "http://localhost:8969/stream"
|
|
154
|
+
*/
|
|
155
|
+
spotlightSidecarUrl?: string;
|
|
137
156
|
}
|
|
138
157
|
export interface ReactNativeTransportOptions extends BrowserTransportOptions {
|
|
139
158
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react-native" />
|
|
1
2
|
import type { InternalGlobal } from '@sentry/utils';
|
|
2
3
|
import type { ErrorUtils } from 'react-native/types';
|
|
3
4
|
import type { ExpoGlobalObject } from './expoglobalobject';
|
|
@@ -13,6 +14,7 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
|
13
14
|
nativeFabricUIManager: unknown;
|
|
14
15
|
ErrorUtils?: ErrorUtils;
|
|
15
16
|
expo?: ExpoGlobalObject;
|
|
17
|
+
XMLHttpRequest?: typeof XMLHttpRequest;
|
|
16
18
|
}
|
|
17
19
|
/** Get's the global object for the current JavaScript runtime */
|
|
18
20
|
export declare const RN_GLOBAL_OBJ: ReactNativeInternalGlobal;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react-native" />
|
|
2
|
+
/**
|
|
3
|
+
* The DONE ready state for XmlHttpRequest
|
|
4
|
+
*
|
|
5
|
+
* Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined
|
|
6
|
+
* (e.g. during testing, it is `undefined`)
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}
|
|
9
|
+
*/
|
|
10
|
+
export declare const XHR_READYSTATE_DONE = 4;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new XMLHttpRequest object which is not instrumented by the SDK.
|
|
13
|
+
*
|
|
14
|
+
* This request won't be captured by the HttpClient Errors integration
|
|
15
|
+
* and won't be added to breadcrumbs and won't be traced.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createStealthXhr(customGlobal?: {
|
|
18
|
+
XMLHttpRequest?: typeof XMLHttpRequest;
|
|
19
|
+
}): XMLHttpRequest | null;
|
|
20
|
+
//# sourceMappingURL=xhr.d.ts.map
|
|
@@ -52,11 +52,11 @@ interface SentryNativeWrapper {
|
|
|
52
52
|
hermesProfile: Hermes.Profile;
|
|
53
53
|
nativeProfile?: NativeProfileEvent;
|
|
54
54
|
} | null;
|
|
55
|
-
fetchNativePackageName():
|
|
55
|
+
fetchNativePackageName(): string | null;
|
|
56
56
|
/**
|
|
57
57
|
* Fetches native stack frames and debug images for the instructions addresses.
|
|
58
58
|
*/
|
|
59
|
-
fetchNativeStackFramesBy(instructionsAddr: number[]):
|
|
59
|
+
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Our internal interface for calling native functions
|