Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
- Bump Android SDK from v8.17.0 to v8.20.0 ([#5034](https://github.com/getsentry/sentry-react-native/pull/5034), [#5063](https://github.com/getsentry/sentry-react-native/pull/5063), [#5106](https://github.com/getsentry/sentry-react-native/pull/5106))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8200)
- [diff](https://github.com/getsentry/sentry-java/compare/8.17.0...8.20.0)
- Bump JavaScript SDK from v9.22.0 to v10.7.0 ([#5111](https://github.com/getsentry/sentry-react-native/pull/5111))
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#1070)
- [diff](https://github.com/getsentry/sentry-javascript/compare/9.22.0...10.7.0)


## 7.0.0-rc.1

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": "9.22.0",
"@sentry/core": "10.7.0",
"@sentry/react-native": "7.0.0-rc.1",
"@types/node": "^20.9.3",
"@types/react": "^18.2.64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/core');
logger.enable();
const { debug } = require('@sentry/core');
debug.enable();

const args = parseArgs(argv.slice(2));
if (!args['app-build-gradle']) {
throw new Error('Missing --app-build-gradle');
}

logger.info('Patching app/build.gradle', args['app-build-gradle']);
debug.log('Patching app/build.gradle', args['app-build-gradle']);

const sentryGradlePatch = `
apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle")
Expand All @@ -26,7 +26,7 @@ if (!isPatched) {
const patched = buildGradle.replace(reactNativeGradleRex, m => sentryGradlePatch + m);

fs.writeFileSync(args['app-build-gradle'], patched);
logger.info('Patched app/build.gradle successfully!');
debug.log('Patched app/build.gradle successfully!');
} else {
logger.info('app/build.gradle is already patched!');
debug.log('app/build.gradle is already patched!');
}
10 changes: 5 additions & 5 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const path = require('path');
const { argv, env } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/core');
logger.enable();
const { debug } = require('@sentry/core');
debug.enable();

const SENTRY_RELEASE = env.SENTRY_RELEASE;
const SENTRY_DIST = env.SENTRY_DIST;
Expand All @@ -16,7 +16,7 @@ if (!args.app) {
throw new Error('Missing --app');
}

logger.info('Patching RN App.(js|tsx)', args.app);
debug.log('Patching RN App.(js|tsx)', args.app);

const initPatch = `
import * as Sentry from '@sentry/react-native';
Expand Down Expand Up @@ -59,7 +59,7 @@ if (!isPatched) {
.replace(exportDefaultRex, 'export default Sentry.wrap(App);');

fs.writeFileSync(appPath, patched);
logger.info('Patched RN App.(js|tsx) successfully!');
debug.log('Patched RN App.(js|tsx) successfully!');
} else {
logger.info('App.(js|tsx) already patched!');
debug.log('App.(js|tsx) already patched!');
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/core');
logger.enable();
const { debug } = require('@sentry/core');
debug.enable();

const args = parseArgs(argv.slice(2));
if (!args['gradle-properties']) {
Expand All @@ -21,7 +21,7 @@ if (enableHermes === null) {
throw new Error('Invalid engine');
}

logger.info('Patching gradle.properties', args['gradle-properties']);
debug.log('Patching gradle.properties', args['gradle-properties']);
let content = fs.readFileSync(args['gradle-properties'], 'utf8');

const isHermesEnabled = content.includes('hermesEnabled=true');
Expand All @@ -31,9 +31,9 @@ if (enableHermes !== isHermesEnabled) {
? content.replace(/hermesEnabled=.*/g, patch)
: content.concat(`\n${patch}`);
if (enableHermes) {
logger.info('Patching gradle.properties for Hermes');
debug.log('Patching gradle.properties for Hermes');
} else {
logger.info('Patching gradle.properties for JSC');
debug.log('Patching gradle.properties for JSC');
}
}

Expand Down
10 changes: 5 additions & 5 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/core');
logger.enable();
const { debug } = require('@sentry/core');
debug.enable();

const args = parseArgs(argv.slice(2));
if (!args.path) {
throw new Error('Missing --path');
}

logger.info('Patching Metro config: ', args.path);
debug.log('Patching Metro config: ', args.path);

const configFilePath = args.path;

Expand Down Expand Up @@ -52,7 +52,7 @@ if (!isPatched) {
}

fs.writeFileSync(configFilePath, config.join('\n'), 'utf8');
logger.info('Patched Metro config successfully!');
debug.log('Patched Metro config successfully!');
} else {
logger.info('Metro config already patched!');
debug.log('Metro config already patched!');
}
12 changes: 6 additions & 6 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/core');
logger.enable();
const { debug } = require('@sentry/core');
debug.enable();

const args = parseArgs(argv.slice(2));
if (!args['pod-file']) {
Expand All @@ -21,7 +21,7 @@ if (enableHermes === null) {
throw new Error('Invalid engine');
}

logger.info('Patching Podfile', args['pod-file']);
debug.log('Patching Podfile', args['pod-file']);
const content = fs.readFileSync(args['pod-file'], 'utf8');

const isHermesEnabled = content.includes(':hermes_enabled => true,');
Expand All @@ -32,11 +32,11 @@ if (shouldPatch) {
enableHermes ? ':hermes_enabled => true,' : ':hermes_enabled => false,',
);
if (enableHermes) {
logger.info('Patching Podfile for Hermes');
debug.log('Patching Podfile for Hermes');
} else {
logger.info('Patching Podfile for JSC');
debug.log('Patching Podfile for JSC');
}
fs.writeFileSync(args['pod-file'], patched);
} else {
logger.info('Podfile is already patched!');
debug.log('Podfile is already patched!');
}
38 changes: 16 additions & 22 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { argv } = require('process');
const xcode = require('xcode');
const parseArgs = require('minimist');
const semver = require('semver');
const { logger } = require('@sentry/core');
logger.enable();
const { debug } = require('@sentry/core');
debug.enable();

const args = parseArgs(argv.slice(2));
if (!args.project) {
Expand All @@ -17,7 +17,7 @@ if (!args['rn-version']) {
throw new Error('Missing --rn-version');
}

logger.info('Patching Xcode project', args.project, 'for RN version', args['rn-version']);
debug.log('Patching Xcode project', args.project, 'for RN version', args['rn-version']);

const newBundleScriptRNVersion = '0.69.0-rc.0';

Expand All @@ -29,15 +29,15 @@ const symbolsScript = `
`;
const symbolsPatchRegex = /sentry-cli\s+(upload-dsym|debug-files upload)/;
if (semver.satisfies(args['rn-version'], `< ${newBundleScriptRNVersion}`, { includePrerelease: true })) {
logger.info('Applying old bundle script patch');
debug.log('Applying old bundle script patch');
bundleScript = `
export NODE_BINARY=node
../node_modules/@sentry/react-native/scripts/sentry-xcode.sh ../node_modules/react-native/scripts/react-native-xcode.sh
`;
bundleScriptRegex = /(packager|scripts)\/react-native-xcode\.sh\b/;
bundlePatchRegex = /sentry-cli\s+react-native[\s-]xcode/;
} else if (semver.satisfies(args['rn-version'], `>= ${newBundleScriptRNVersion}`, { includePrerelease: true })) {
logger.info('Applying new bundle script patch');
debug.log('Applying new bundle script patch');
bundleScript = `
WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
Expand All @@ -62,38 +62,32 @@ for (const key in buildPhasesRaw) {
}
}

buildPhases.forEach((phase) => {
buildPhases.forEach(phase => {
const isBundleReactNative = phase.shellScript.match(bundleScriptRegex);
const isPatched = phase.shellScript.match(bundlePatchRegex);
if (!isBundleReactNative) {
return;
}
if (isPatched) {
logger.warn('Xcode project Bundle RN Build phase already patched');
debug.warn('Xcode project Bundle RN Build phase already patched');
return;
}
phase.shellScript = JSON.stringify(bundleScript);
logger.info('Patched Xcode project Bundle RN Build phase');
debug.log('Patched Xcode project Bundle RN Build phase');
});

const isSymbolsPhase = (phase) => phase.shellScript.match(symbolsPatchRegex);
const isSymbolsPhase = phase => phase.shellScript.match(symbolsPatchRegex);
const areSymbolsPatched = buildPhases.some(isSymbolsPhase);

if (!areSymbolsPatched) {
project.addBuildPhase(
[],
'PBXShellScriptBuildPhase',
'Upload Debug Symbols to Sentry',
null,
{
shellPath: '/bin/sh',
shellScript: symbolsScript,
},
);
logger.info('Added Xcode project Upload Debug Symbols Build phase');
project.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: symbolsScript,
});
debug.log('Added Xcode project Upload Debug Symbols Build phase');
} else {
logger.warn('Xcode project Upload Debug Symbols Build phase already patched');
debug.warn('Xcode project Upload Debug Symbols Build phase already patched');
}

fs.writeFileSync(args.project, project.writeSync());
logger.info('Patched Xcode project successfully!');
debug.log('Patched Xcode project successfully!');
2 changes: 1 addition & 1 deletion dev-packages/type-check/ts3.8-test/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"index.ts",
],
"compilerOptions": {
"skipLibCheck": false,
"skipLibCheck": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was added to handle the following type check errors

+ yarn type-check
node_modules/@sentry/browser/build/npm/types-ts3.8/integrations/webWorker.d.ts:4:25 - error TS2304: Cannot find name 'Worker'.

4     addWorker: (worker: Worker) => void;
                          ~~~~~~

node_modules/@sentry/core/build/types-ts3.8/utils/debug-logger.d.ts:18:47 - error TS2339: Property 'assert' does not exist on type 'Console'.

18     assert(...args: Parameters<typeof console.assert>): void;
                                                 ~~~~~~

node_modules/@sentry/core/build/types-ts3.8/utils/openai/types.d.ts:276:42 - error TS2304: Cannot find name 'AsyncIterable'.

276 export interface OpenAIStream<T> extends AsyncIterable<T> {
                                             ~~~~~~~~~~~~~

node_modules/@sentry/core/build/types-ts3.8/utils/openai/types.d.ts:277:13 - error TS2339: Property 'asyncIterator' does not exist on type 'SymbolConstructor'.

277     [Symbol.asyncIterator](): AsyncIterator<T>;
                ~~~~~~~~~~~~~

node_modules/@sentry/core/build/types-ts3.8/utils/openai/types.d.ts:277:31 - error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.

277     [Symbol.asyncIterator](): AsyncIterator<T>;
                                  ~~~~~~~~~~~~~


Found 5 errors.

Any ideas on how to avoid this are more than welcome 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that changing "lib": ["es2020"] (from es2015) fixes 3 of the errors.

node_modules/@sentry/browser/build/npm/types-ts3.8/integrations/webWorker.d.ts:4:25 - error TS2304: Cannot find name 'Worker'.

4     addWorker: (worker: Worker) => void;
                          ~~~~~~

node_modules/@sentry/core/build/types-ts3.8/utils/debug-logger.d.ts:18:47 - error TS2339: Property 'assert' does not exist on type 'Console'.

18     assert(...args: Parameters<typeof console.assert>): void;
                                                 ~~~~~~


Found 2 errors.

"noEmit": true,
"importHelpers": true,
"types": [],
Expand Down
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@
},
"dependencies": {
"@sentry/babel-plugin-component-annotate": "4.0.2",
"@sentry/browser": "9.22.0",
"@sentry/browser": "10.7.0",
"@sentry/cli": "2.50.2",
"@sentry/core": "9.22.0",
"@sentry/react": "9.22.0",
"@sentry/types": "9.22.0"
"@sentry/core": "10.7.0",
"@sentry/react": "10.7.0",
"@sentry/types": "10.7.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@expo/metro-config": "~0.20.0",
"@mswjs/interceptors": "^0.25.15",
"@react-native/babel-preset": "0.77.1",
"@sentry-internal/eslint-config-sdk": "9.22.0",
"@sentry-internal/eslint-plugin-sdk": "9.22.0",
"@sentry-internal/typescript": "9.22.0",
"@sentry-internal/eslint-config-sdk": "10.7.0",
"@sentry-internal/eslint-plugin-sdk": "10.7.0",
"@sentry-internal/typescript": "10.4.0",
"@sentry/wizard": "6.1.0",
"@testing-library/react-native": "^12.7.2",
"@types/jest": "^29.5.13",
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/js/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
_INTERNAL_flushLogsBuffer,
addAutoIpAddressToSession,
addAutoIpAddressToUser,
BaseClient,
Client,
dateTimestampInSeconds,
logger,
debug,
SentryError,
} from '@sentry/core';
import { Alert } from 'react-native';
Expand All @@ -40,7 +40,7 @@ const DEFAULT_FLUSH_INTERVAL = 5000;
* @see ReactNativeClientOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
export class ReactNativeClient extends Client<ReactNativeClientOptions> {
private _outcomesBuffer: Outcome[];
private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;

Expand Down Expand Up @@ -147,13 +147,13 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
// SentryError is thrown by SyncPromise
shouldClearOutcomesBuffer = false;
// If this is called asynchronously we want the _outcomesBuffer to be cleared
logger.error('SentryError while sending event, keeping outcomes buffer:', reason);
debug.error('SentryError while sending event, keeping outcomes buffer:', reason);
} else {
logger.error('Error while sending event:', reason);
debug.error('Error while sending event:', reason);
}
});
} else {
logger.error('Transport disabled');
debug.error('Transport disabled');
}

if (shouldClearOutcomesBuffer) {
Expand Down Expand Up @@ -219,7 +219,7 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
this.emit('afterInit');
})
.then(undefined, error => {
logger.error('The OnReady callback threw an error: ', error);
debug.error('The OnReady callback threw an error: ', error);
});
}

Expand Down
Loading
Loading