getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.56k stars 331 forks source link

[iOS, Xcode, Fastlane] Build fails on main.jsbundle does not exist #4063

Closed Krupskis closed 2 days ago

Krupskis commented 1 week ago

OS:

Platform:

SDK:

SDK version: ^5.31.1

react-native version: 0.71.0

Are you using Expo?

Are you using sentry.io or on-premise?

If you are using sentry.io, please post a link to your issue so we can take a look:

[Link to issue]

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: '...s.sentry.io...',

  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
  // enableSpotlight: __DEV__,
});

I have the following issue:

[Description]

Steps to reproduce:

Actual result:

❌  error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true

❌  error: sentry-cli -   INFO    2024-09-03 11:55:56.918493 +03:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)

    the transform cache was reset.
    Watchman `watch-project` returned a warning: Recrawled this watch 1 time, most recently because:
    Watchman `query` returned a warning: Recrawled this watch 1 time, most recently because:

❌  error: File /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues

Expected result:

Builds successfully

krystofwoldrich commented 1 week ago

Hi @Krupskis, thank you for the message,

can you share the Bundle React Native and images build phase with us?

It's possible the wizard made a mistake when patching it.

The build phase should execute the sentry-xcode.sh. Similar to this https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#configure-automatic-source-maps-upload

Krupskis commented 1 week ago

Thanks @krystofwoldrich. That's very possible, I tried the wizard like 4 times now. It does seem to execute sentry-xcode.sh though.

set -e

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"

/bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\""
Krupskis commented 1 week ago

I tried the script in docs, still same issue.

  error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true
[12:40:36]: ▸ ❌  error: sentry-cli -   INFO    2024-09-03 12:40:24.342848 +03:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)
[12:40:36]: ▸     the transform cache was reset.
[12:40:36]: ▸     Watchman `watch-project` returned a warning: Recrawled this watch 1 time, most recently because:
[12:40:36]: ▸     Watchman `query` returned a warning: Recrawled this watch 1 time, most recently because:
[12:40:36]: ▸ ❌  error: File /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues
krystofwoldrich commented 1 week ago

Can you add export SENTRY_CLI_EXTRA_ARGS="--force-foreground --log-level=debug" to your env and share the script output?


Are you using any extra envs to change packager arguments, source maps paths...?

Krupskis commented 1 week ago

@krystofwoldrich same output

Processing Info.plist
▸ Running script 'Bundle React Native code and images'

❌  error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true

❌  error: sentry-cli -   INFO    2024-09-05 00:38:36.796793 +03:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)

    the transform cache was reset.

❌  error: File /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues

Are you using any extra envs to change packager arguments, source maps paths...?

Not that I am aware of, where would I check? As far as Sentry goes I just did a wizard installation

krystofwoldrich commented 1 week ago

Not that I am aware of, where would I check? As far as Sentry goes I just did a wizard installation

You would check if you are using EXTRA_PACKAGER_ARGS or EXTRA_COMPILER_ARGS.

krystofwoldrich commented 1 week ago

@Krupskis Are you able to reproduce this in a new 0.71 RN application? If so, could you share it with us?

jawad-elchawich commented 6 days ago

facing same issue on version 5.31.1 and RN v0.72.9

Krupskis commented 6 days ago

You would check if you are using EXTRA_PACKAGER_ARGS or EXTRA_COMPILER_ARGS.

Nope, not using any.

fi-nik commented 6 days ago

@Krupskis Im not sure if this info could help you out. I had similar issues, problem was with source maps. For me problem was target name, which had blank space. Other target was working as expected, so a soon i removed space in target name, it worked.

krystofwoldrich commented 5 days ago

@fi-nik Thanks for the tip, yes, white space in the target name will cause issues before RN 0.74.

But this error message is different than the ones in the issues above.

krystofwoldrich commented 5 days ago

@Krupskis Could you share the output of the Bundle React Native code and images leading to the error.

So we can investigate this more.

Or if you could share a reproducible example that would help speed the debugging a lot.

Krupskis commented 5 days ago

@fi-nik Thanks for the tip, our target is just one word

Krupskis commented 5 days ago

Could you share the output of the Bundle React Native code and images leading to the error.

This is all of it from fastlane.

▸ Running script 'Bundle React Native code and images'

❌  error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true

❌  error: sentry-cli -   INFO    2024-09-10 15:27:46.638608 +03:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)

    the transform cache was reset.

❌  error: File /Users/mkrupskis/Library/Developer/Xcode/DerivedData/app-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/app/BuildProductsPath/Release-iphoneos/app.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues

▸ Generating 'app.app.dSYM'
▸ Running script '[CP] Embed Pods Frameworks'
▸ Running script '[CP] Copy Pods Resources'
▸ Running script '[CP-User] [RNFB] Core Configuration'
▸ Running script 'Upload Debug Symbols to Sentry'
▸ Touching app.app (in target 'app' from project 'app')
    Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app')
    Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app')
    Run script build phase '[CP-User] [RNFB] Core Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app')
    Run script build phase 'Upload Debug Symbols to Sentry' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'fmt' from project 'Pods')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Codegen' from project 'Pods')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RCT-Folly' from project 'Pods')
    Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
** ARCHIVE FAILED **
[15:28:19]: Exit status: 65

+---------------------------------------+
|           Build environment           |
+-------------+-------------------------+
| xcode_path  | /Applications/Xcode.app |
| gym_version | 2.221.1                 |
| sdk         | iPhoneOS17.0.sdk        |
+-------------+-------------------------+

[15:28:19]: ▸ warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'fmt' from project 'Pods')
[15:28:19]: ▸ warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
[15:28:19]: ▸ warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Codegen' from project 'Pods')
[15:28:19]: ▸ warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RCT-Folly' from project 'Pods')
[15:28:19]: ▸ warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
[15:28:19]: 
[15:28:19]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[15:28:19]: 📋  For the complete and more detailed error log, check the full log at:
[15:28:19]: 📋  /Users/mkrupskis/Library/Logs/gym/app-app.log
[15:28:19]: 
[15:28:19]: Looks like fastlane ran into a build/archive error with your project
[15:28:19]: It's hard to tell what's causing the error, so we wrote some guides on how
[15:28:19]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[15:28:19]: Before submitting an issue on GitHub, please follow the guide above and make
[15:28:19]: sure your project is set up correctly.
[15:28:19]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[15:28:19]: the full commands printed out in yellow in the above log.
[15:28:19]: Make sure to inspect the output above, as usually you'll find more error information there
[15:28:19]: 
Krupskis commented 5 days ago

Found in /Library/Logs/gym, might be helpful

Node found at: /var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node
+ LOCAL_NODE_BINARY=/var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node
+ '[' -z '' ']'
+ export SENTRY_PROPERTIES=sentry.properties
+ SENTRY_PROPERTIES=sentry.properties
+ '[' -z '' ']'
+ export SOURCEMAP_FILE=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
+ SOURCEMAP_FILE=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
+ '[' -z '' ']'
++ /var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node --print 'require('\''path'\'').dirname(require.resolve('\''@sentry/cli/package.json'\''))'
+ SENTRY_CLI_PACKAGE_PATH=/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli
+ '[' -z '' ']'
+ SENTRY_CLI_EXECUTABLE=/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli/bin/sentry-cli
+ REACT_NATIVE_XCODE=../node_modules/react-native/scripts/react-native-xcode.sh
+ [[ '' == false ]]
+ ARGS='  '
+ REACT_NATIVE_XCODE_WITH_SENTRY='"/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli/bin/sentry-cli" react-native xcode    "../node_modules/react-native/scripts/react-native-xcode.sh"'
+ '[' '' '!=' true ']'
+ set +x +e
error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true
error: sentry-cli -   INFO    2024-09-10 15:27:46.638608 +03:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)
  WARN    2024-09-10 15:27:46.638868 +03:00 Using https://sentry.io (embedded in token) rather than manually-configured URL https://sentry.io/. To use https://sentry.io/, please provide an auth token for this URL.
+ DEST=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app
+ [[ ! -n '' ]]
+ [[ Release = *Debug* ]]
+ [[ -n '' ]]
+ case "$CONFIGURATION" in
+ DEV=false
+++ dirname /Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/react-native-xcode.sh
++ cd /Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/..
++ pwd
+ REACT_NATIVE_DIR=/Users/mkrupskis/Developer/compass-temp/node_modules/react-native
+ PROJECT_ROOT=/Users/mkrupskis/Developer/compass-temp/node_modules/react-native/../..
+ cd /Users/mkrupskis/Developer/compass-temp/node_modules/react-native/../..
+ [[ -n '' ]]
+ [[ -s index.ios.js ]]
+ ENTRY_FILE=index.js
+ source /Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/node-binary.sh
++ '[' -z /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli-darwin/bin/sentry-cli ']'
++ type /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli-darwin/bin/sentry-cli
++ grep hermes-engine /Users/mkrupskis/Developer/compass-temp/ios/./Podfile.lock
+ HERMES_ENABLED='  - hermes-engine (0.71.0):
    - hermes-engine/Pre-built (= 0.71.0)
  - hermes-engine/Pre-built (0.71.0)
    - hermes-engine
    - hermes-engine
    - hermes-engine
    - hermes-engine
  - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
  hermes-engine:
    :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
  hermes-engine: f6e715aa6c8bd38de6c13bc85e07b0a337edaa89'
+ [[ -z   - hermes-engine (0.71.0):
    - hermes-engine/Pre-built (= 0.71.0)
  - hermes-engine/Pre-built (0.71.0)
    - hermes-engine
    - hermes-engine
    - hermes-engine
    - hermes-engine
  - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
  hermes-engine:
    :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
  hermes-engine: f6e715aa6c8bd38de6c13bc85e07b0a337edaa89 ]]
+ HERMES_ENGINE_PATH=/Users/mkrupskis/Developer/compass-temp/ios/Pods/hermes-engine
+ '[' -z /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli-darwin/bin/sentry-cli ']'
+ [[ ! -z   - hermes-engine (0.71.0):
    - hermes-engine/Pre-built (= 0.71.0)
  - hermes-engine/Pre-built (0.71.0)
    - hermes-engine
    - hermes-engine
    - hermes-engine
    - hermes-engine
  - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
  hermes-engine:
    :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
  hermes-engine: f6e715aa6c8bd38de6c13bc85e07b0a337edaa89 ]]
+ [[ -f /Users/mkrupskis/Developer/compass-temp/ios/Pods/hermes-engine ]]
+ '[' -z '' ']'
+ export NODE_ARGS=
+ NODE_ARGS=
+ '[' -z '' ']'
+ export CLI_PATH=/Users/mkrupskis/Developer/compass-temp/node_modules/react-native/cli.js
+ CLI_PATH=/Users/mkrupskis/Developer/compass-temp/node_modules/react-native/cli.js
+ '[' -z '' ']'
+ BUNDLE_COMMAND=bundle
+ '[' -z '' ']'
+ COMPOSE_SOURCEMAP_PATH=/Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/compose-source-maps.js
+ [[ -z '' ]]
+ CONFIG_ARG=
+ BUNDLE_FILE=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle
+ EXTRA_ARGS=
+ case "$PLATFORM_NAME" in
+ BUNDLE_PLATFORM=ios
+ '[' '' = YES ']'
+ EMIT_SOURCEMAP=
+ [[ ! -z /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map ]]
+ EMIT_SOURCEMAP=true
+ PACKAGER_SOURCEMAP_FILE=
+ [[ true == true ]]
+ [[ '' != false ]]
++ basename /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
+ PACKAGER_SOURCEMAP_FILE=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map
+ EXTRA_ARGS=' --sourcemap-output /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
+ [[ '' != false ]]
+ [[ false == false ]]
+ EXTRA_ARGS=' --sourcemap-output /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map --minify false'
+ /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli-darwin/bin/sentry-cli /Users/mkrupskis/Developer/compass-temp/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle --assets-dest /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app --sourcemap-output /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map --minify false
warning: the transform cache was reset.
                Welcome to Metro v0.73.10
              Fast - Scalable - Integrated

error Cannot read properties of undefined (reading 'size').
TypeError: Cannot read properties of undefined (reading 'size')
    at getAppendScripts (/Users/mkrupskis/Developer/compass-temp/node_modules/metro/src/lib/getAppendScripts.js:25:25)
    at baseJSBundle (/Users/mkrupskis/Developer/compass-temp/node_modules/metro/src/DeltaBundler/Serializers/baseJSBundle.js:39:5)
    at /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/dist/js/tools/vendor/metro/utils.js:32:22
    at Object.<anonymous> (/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/dist/js/tools/sentryMetroSerializer.js:53:38)
    at Generator.next (<anonymous>)
    at /Users/mkrupskis/Developer/compass-temp/node_modules/tslib/tslib.js:169:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/mkrupskis/Developer/compass-temp/node_modules/tslib/tslib.js:165:16)
    at Object.customSerializer (/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/dist/js/tools/sentryMetroSerializer.js:39:24)
    at Server.build (/Users/mkrupskis/Developer/compass-temp/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/Server.js:153:52)
info Run CLI with --verbose flag for more details.
+ [[ '' == false ]]
+ EXTRA_COMPILER_ARGS=
+ [[ false == true ]]
+ EXTRA_COMPILER_ARGS=-O
+ [[ true == true ]]
+ EXTRA_COMPILER_ARGS='-O -output-source-map'
+ /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli-darwin/bin/sentry-cli -emit-binary -O -output-source-map -out /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle
Error! Failed to open file: /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle
+ [[ true == true ]]
+ HBC_SOURCEMAP_FILE=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle.map
+ /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/cli-darwin/bin/sentry-cli /Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/compose-source-maps.js /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle.map -o /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
    at Object.readFileSync (node:fs:441:20)
    at Object.<anonymous> (/Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/compose-source-maps.js:34:8)
    at Module._compile (node:internal/modules/cjs/loader:1504:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
    at node:internal/main/run_main_module:30:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
}

Node.js v22.5.1
+ rm /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle.map
rm: /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle.map: No such file or directory
+ rm /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map
rm: /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map: No such file or directory
+ BUNDLE_FILE=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle
+ [[ false != true ]]
+ [[ ! -f /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle ]]
+ echo 'error: File /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues'
error: File /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues
+ exit 2
+ '[' -z '' ']'
++ /var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node --print 'require('\''path'\'').dirname(require.resolve('\''@sentry/react-native/package.json'\''))'
+ SENTRY_RN_PACKAGE_PATH=/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native
+ '[' -z '' ']'
+ SENTRY_COLLECT_MODULES=/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts/collect-modules.sh
+ '[' -f /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts/collect-modules.sh ']'
+ /bin/sh /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts/collect-modules.sh
+ [[ Release = *Debug* ]]
+ [[ -z /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos ]]
+ [[ -z compass.app ]]
+ [[ -z /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources ]]
+ nodePath=node
+ [[ -n /var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node ]]
+ nodePath=/var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node
++ dirname /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts/collect-modules.sh
+ thisFilePath=/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts
+ collectModulesScript=/Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts/../dist/js/tools/collectModules.js
+ destination=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app
+ modulesOutput=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/modules.json
+ [[ -z '' ]]
+ sourceMap=/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
+ [[ -z '' ]]
+ modulesPaths=/Users/mkrupskis/Developer/compass-temp/ios/../node_modules
+ type /var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node
+ /var/folders/xf/4_1r1vbs52lcp6ps858p5vp40000gn/T/yarn--1725971028795-0.4785959350414606/node /Users/mkrupskis/Developer/compass-temp/node_modules/@sentry/react-native/scripts/../dist/js/tools/collectModules.js /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/modules.json /Users/mkrupskis/Developer/compass-temp/ios/../node_modules
Sentry Logger [info]: Reading source map from /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
Sentry Logger [info]: Saving modules to /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/compass.app/modules.json
Sentry Logger [info]: Resolving modules from paths /Users/mkrupskis/Developer/compass-temp/ios/../node_modules
Sentry Logger [error]: Source map file does not exist at /Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/IntermediateBuildFilesPath/compass.build/Release-iphoneos/compass.build/DerivedSources/main.jsbundle.map
Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure
Krupskis commented 5 days ago

This is another property in .xcode.env, might node binary have something to do with this? Looks like node that is used for the above script is not the one returned by command -v node.

export NODE_BINARY=$(command -v node)
krystofwoldrich commented 2 days ago

Hi @Krupskis, thank you for all the log,

the culprit is this error from the logs

node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
    at Object.readFileSync (node:fs:441:20)
    at Object.<anonymous> (/Users/mkrupskis/Developer/compass-temp/node_modules/react-native/scripts/compose-source-maps.js:34:8)
    at Module._compile (node:internal/modules/cjs/loader:1504:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
    at node:internal/main/run_main_module:30:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/mkrupskis/Library/Developer/Xcode/DerivedData/compass-cxvoclnijoxfzeejovxldioighcv/Build/Intermediates.noindex/ArchiveIntermediates/compass/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
}

This happens when hosisted metro dependency is not the one shipped with the RN version you are using.

Please follow the fix from https://github.com/getsentry/sentry-react-native/issues/3622#issuecomment-1971056220 and make sure your metro.config.js is configured like https://docs.sentry.io/platforms/react-native/manual-setup/metro/

I'll close this issue, please add any future comments the https://github.com/getsentry/sentry-react-native/issues/3622