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

Invalid Source map #1457

Closed
1 of 2 tasks
evolvingkid opened this issue Jul 12, 2024 · 1 comment
Closed
1 of 2 tasks

Invalid Source map #1457

evolvingkid opened this issue Jul 12, 2024 · 1 comment
Labels
need more info Awating additional info before proceeding

Comments

@evolvingkid
Copy link

evolvingkid commented Jul 12, 2024

Bug Description

Error code is not connecting with the source map from IOS.

Screenshot 2024-07-12 at 11 47 58 AM

We use export SOURCEMAP_FILE="ios/main.jsbundle.map"; in the react native code and image to get the source mapping from the build generated from Xcode.

export SOURCEMAP_FILE="ios/main.jsbundle.map";
export PATH=/opt/homebrew/bin:$PATH
set -e

export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh

Code in the Bundle React Native code and images in xcode.

This will generate a bundle.map file in the IOS directory. But when Bugsnag tries to get the error line it will fail.

We run a custom code to check if this specific error is coming from source map by running the below script.

const fs = require("fs");
const sourceMap = require("source-map");

const mapPath = "./main.jsbundle.map";

const minifiedLocation = { line: 1, column: 3497710 };
const sourceMapContent = fs.readFileSync(mapPath, "utf8");

sourceMap.SourceMapConsumer.with(sourceMapContent, null, (consumer) => {
  const originalPosition = consumer.originalPositionFor(minifiedLocation);
  console.log("mapped location", originalPosition);
});

This will output null as the result. mapped location { source: null, line: null, column: null, name: null }

  • I have run gradle clean and confirmed this bug does not occur with JSC
  • The issue is reproducible with the latest version of React Native.

Hermes git revision (if applicable):
React Native version: ^0.72.3
OS:

Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): IOS iphone

Steps To Reproduce

  1. Create a source map from Xcode.

code example:

The Expected Behavior

The source map should be pointing toward the error in the onPressRoundedNextLogin function.


  const onPressRoundedNextLogin = async (text) => {
    Bugsnag.notify(new Error('Test error'));
    }

@evolvingkid evolvingkid added the bug Something isn't working label Jul 12, 2024
@tmikov
Copy link
Contributor

tmikov commented Jul 12, 2024

I am sorry, I understand that you are having a problem, but your description is referring to libraries and tools that are not part of Hermes. For example, I don't know what Bugsnag is, I don't know what "Create a source map from Xcode" means. Similarly, react-native/scripts/react-native-xcode.sh is not part of Hermes and I have no idea what it does.

Can you provide a minimal isolated reproduction that demonstrates a specific problem in Hermes?

@tmikov tmikov added need more info Awating additional info before proceeding and removed bug Something isn't working labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Awating additional info before proceeding
Projects
None yet
Development

No branches or pull requests

3 participants