Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main.jsbundle.map not found in bundle phase #3723

Closed
5 of 11 tasks
francescov1 opened this issue Mar 27, 2024 · 6 comments
Closed
5 of 11 tasks

main.jsbundle.map not found in bundle phase #3723

francescov1 opened this issue Mar 27, 2024 · 6 comments

Comments

@francescov1
Copy link

francescov1 commented Mar 27, 2024

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.20.0

react-native version: 0.73.6

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • 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: 'https://...@sentry.io/...'
  // other options
});

I have the following issue:

I can build and run my app fine locally, but when trying to archive, I get an error related to finding a main.jsbundle.map file

As a temporary fix, I reverted the changes made in the Bundle React Native code and images phase.

Steps to reproduce:

  • Run an archive

Actual result:

Error. See logs below:

+ [[ true == true ]]
+ HBC_SOURCEMAP_FILE='/Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/BuildProductsPath/Release-iphoneos/LighthouseMobile.app/main.jsbundle.map'
+ /Users/francescovirga/Projects/lighthouse-mobile/node_modules/@sentry/cli-darwin/bin/sentry-cli /Users/francescovirga/Projects/lighthouse-mobile/node_modules/react-native/scripts/compose-source-maps.js '/Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/BuildProductsPath/Release-iphoneos/main.jsbundle.map' '/Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/BuildProductsPath/Release-iphoneos/LighthouseMobile.app/main.jsbundle.map' -o '/Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/IntermediateBuildFilesPath/LighthouseMobile.build/Release-iphoneos/LighthouseMobile.build/DerivedSources/main.jsbundle.map'
node:internal/fs/sync:25
  return binding.readFileUtf8(path, stringToFlags(flag));
                 ^

Error: ENOENT: no such file or directory, open '/Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Object.<anonymous> (/Users/francescovirga/Projects/lighthouse-mobile/node_modules/react-native/scripts/compose-source-maps.js:34:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/BuildProductsPath/Release-iphoneos/main.jsbundle.map'
}

Node.js v20.9.0
Command PhaseScriptExecution failed with a nonzero exit code

Expected result:

No error

@krystofwoldrich
Copy link
Member

Hi @francescov1,
thank you for the message.

It seems like the packager source map was not found at the expected location /Users/francescovirga/Library/Developer/Xcode/DerivedData/LighthouseMobile-clqkvaplifyotcdbrajpghsatkgw/Build/Intermediates.noindex/ArchiveIntermediates/LighthouseMobile (Production)/BuildProductsPath/Release-iphoneos/main.jsbundle.map.

From the stack trace I don't see why that would happen, can you share the build phase changes, do they match our documentation? https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#configure-automatic-source-maps-upload

@getsantry getsantry bot removed the status in GitHub Issues with 👀 2 Apr 2, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Apr 2, 2024
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 2 Apr 2, 2024
@francescov1
Copy link
Author

@krystofwoldrich Thanks for the reply. I used the automated CLI setup. Here's the relevant build phases:

Bundle React Native code and images (note the change I made at the end, this is the workaround I had to do to get this to work, essentially skip the Sentry step).

set -e

# https://github.com/facebook/react-native/issues/25522#issuecomment-509036251
export NODE_BINARY=$(which node)

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\""
/bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"

Upload Debug Symbols to Sentry:

/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 2 Apr 2, 2024
@krystofwoldrich
Copy link
Member

krystofwoldrich commented Apr 4, 2024

Hi @francescov1,
thank you for the build phases they are correct.

The issue is with the white space in your project path LighthouseMobile (Production), this is a known React Native issue, and it will be fixed in RN 0.74, until then you have to adjust the path, in this case, the archive name.

sentry-xcode.sh enables source maps automatically that's why the build fails when using the Sentry Script.

I'll close the issue, but please let us know if this has not fixed it.

@krystofwoldrich krystofwoldrich closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
@github-project-automation github-project-automation bot moved this from Needs More Information to Done in Mobile & Cross Platform SDK Apr 4, 2024
@klosowsk
Copy link

klosowsk commented Apr 5, 2024

This is how I fixed the issue after a react native version upgrade:
https://stackoverflow.com/a/78282118/6084008

@francescov1
Copy link
Author

@krystofwoldrich Thanks for your response, what exactly do I need to change to fix this? Do you mean to change the entire project name, or is there some path I can tweak for an easy fix? I suspect I just need to escape the whitespace character somewhere in one of the scripts?

@pavelglebov
Copy link

I have the same error, but I don't have spaces in folder structure. So the issue is in something else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

No branches or pull requests

4 participants