From 04928fd1b27ea7f38b37dcb6a4aebf7e44fbf248 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 25 Sep 2025 11:20:11 +0200 Subject: [PATCH 1/5] Fixes baseJSBundle resolution --- packages/core/src/js/tools/vendor/metro/utils.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/core/src/js/tools/vendor/metro/utils.ts b/packages/core/src/js/tools/vendor/metro/utils.ts index 5b9ae21049..18857de885 100644 --- a/packages/core/src/js/tools/vendor/metro/utils.ts +++ b/packages/core/src/js/tools/vendor/metro/utils.ts @@ -31,13 +31,19 @@ import type * as sourceMapStringType from 'metro/private/DeltaBundler/Serializer import type * as bundleToStringType from 'metro/private/lib/bundleToString'; import type { MetroSerializer } from '../../utils'; -let baseJSBundle: typeof baseJSBundleType; +let baseJSBundleModule: any; try { - baseJSBundle = require('metro/private/DeltaBundler/Serializers/baseJSBundle'); -} catch (e) { - baseJSBundle = require('metro/src/DeltaBundler/Serializers/baseJSBundle'); + baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle'); +} catch { + baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle'); } +const baseJSBundle: typeof baseJSBundleType = + typeof baseJSBundleModule === 'function' + ? baseJSBundleModule + : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default; + let sourceMapString: typeof sourceMapStringType; try { // eslint-disable-next-line @typescript-eslint/no-var-requires From 2858b2796df7a12a9ef82df6c0f36d91506faab6 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 25 Sep 2025 11:20:33 +0200 Subject: [PATCH 2/5] Fixes bundleToString resolution --- packages/core/src/js/tools/vendor/metro/utils.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/core/src/js/tools/vendor/metro/utils.ts b/packages/core/src/js/tools/vendor/metro/utils.ts index 18857de885..290983b6c3 100644 --- a/packages/core/src/js/tools/vendor/metro/utils.ts +++ b/packages/core/src/js/tools/vendor/metro/utils.ts @@ -58,13 +58,19 @@ try { } } -let bundleToString: typeof bundleToStringType; +let bundleToStringModule: any; try { - bundleToString = require('metro/private/lib/bundleToString'); -} catch (e) { - bundleToString = require('metro/src/lib/bundleToString'); + bundleToStringModule = require('metro/private/lib/bundleToString'); +} catch { + bundleToStringModule = require('metro/src/lib/bundleToString'); } +const bundleToString: typeof bundleToStringType = + typeof bundleToStringModule === 'function' + ? bundleToStringModule + : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + bundleToStringModule?.bundleToString ?? bundleToStringModule?.default; + type NewSourceMapStringExport = { // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28 sourceMapString: typeof sourceMapString; From 985e404d6274b44e19ed570581b52a3ce6437385 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 25 Sep 2025 11:21:14 +0200 Subject: [PATCH 3/5] Temporarily set SENTRY_DISABLE_AUTO_UPLOAD to true --- .github/workflows/e2e-v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-v2.yml b/.github/workflows/e2e-v2.yml index 2b6d9480c6..10f1f61374 100644 --- a/.github/workflows/e2e-v2.yml +++ b/.github/workflows/e2e-v2.yml @@ -160,7 +160,7 @@ jobs: USE_FRAMEWORKS: ${{ matrix.ios-use-frameworks }} PRODUCTION: ${{ matrix.build-type == 'production' && '1' || '0' }} RCT_NEW_ARCH_ENABLED: ${{ matrix.rn-architecture == 'new' && '1' || '0' }} - SENTRY_DISABLE_AUTO_UPLOAD: 'false' + SENTRY_DISABLE_AUTO_UPLOAD: 'true' strategy: fail-fast: false # keeps matrix running if one fails matrix: From c0945827333d00d76033837fde4b6d03ecb44fb3 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 25 Sep 2025 13:05:26 +0200 Subject: [PATCH 4/5] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed1743166..c88d5469bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### Fixes - Vendor `metro/countLines` function to avoid issues with the private import ([#5185](https://github.com/getsentry/sentry-react-native/pull/5185)) +- Fix baseJSBundle and bundleToString TypeErrors with Metro 0.83.2 ([#5206](https://github.com/getsentry/sentry-react-native/pull/5206)) ## 7.1.0 From dacc3f920d8f142bcd3fbc3460e23f78cacc86a1 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 25 Sep 2025 16:34:03 +0200 Subject: [PATCH 5/5] Revert "Temporarily set SENTRY_DISABLE_AUTO_UPLOAD to true" (#5209) This reverts commit 985e404d6274b44e19ed570581b52a3ce6437385. --- .github/workflows/e2e-v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-v2.yml b/.github/workflows/e2e-v2.yml index 10f1f61374..2b6d9480c6 100644 --- a/.github/workflows/e2e-v2.yml +++ b/.github/workflows/e2e-v2.yml @@ -160,7 +160,7 @@ jobs: USE_FRAMEWORKS: ${{ matrix.ios-use-frameworks }} PRODUCTION: ${{ matrix.build-type == 'production' && '1' || '0' }} RCT_NEW_ARCH_ENABLED: ${{ matrix.rn-architecture == 'new' && '1' || '0' }} - SENTRY_DISABLE_AUTO_UPLOAD: 'true' + SENTRY_DISABLE_AUTO_UPLOAD: 'false' strategy: fail-fast: false # keeps matrix running if one fails matrix: