question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source map line number is shifted

See original GitHub issue

This produces at least on Android

I am generating source maps but adding extra packager args in my build.gradle like this

project.ext.react = [
    extraPackagerArgs: isCiBuilding
        ? ["--sourcemap-output", "pathtoMyFolder/index.android.bundle.map"]
        : []
]

After that I just upload that source map file to Bugsnag which is my crashreporter. The crash gives me right file .tsx extension but the line is wrong.

Can you help me to solve this? How to start debugging this? Do I have to pass some arguments to transformer or something?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ds300commented, May 25, 2018

Sorry I haven’t looked into this issue

1reaction
ankitmittal000commented, Jun 1, 2018

I have put this comment on other issue (https://github.com/ds300/react-native-typescript-transformer/issues/11) but seems that one is closed. Since this one is related so putting it here.

I have tried to test this issue with new version of React Native and I am still able to reproduce it on both android and iOS. I have forked https://github.com/hffmnn/react-native-typescript-starter which is itself a fork of https://github.com/cbrevik/react-native-typescript-starter.

My changes just include changing various versions of dependencies in package.json

So here are the steps

git clone https://github.com/ankitmittal000/react-native-typescript-starter.git
cd react-native-typescript-starter
git checkout --track origin/feature/ts_map_with_new_version
yarn
yarn bundle:ios:release
yarn bundle:android:release

Once you get the bundle generated using above commands, you run the respective android and iOS projects.

For Android project

You will get the following exception which is right

 com.facebook.react.common.JavascriptException: undefined is not an object (evaluating '(void 0).value'), stack:
                                                                       <unknown>@346:460
                                                                       <unknown>@61:2003
                                                                       y@61:1110
                                                                       callTimers@61:3501
                                                                       value@27:4401
                                                                       <unknown>@27:1151
                                                                       value@27:3828
                                                                       value@27:1123

When you try

./symbolicate.js android/main.jsbundle.map 346 460

it will give you

/react_native/react-native-typescript-starter/src/index.tsx:20:10

However this is wrong. The correct result should be

/react_native/react-native-typescript-starter/src/index.tsx:22:10

For iPhone

When you run the app on iPhone you will get the following

typescriptStarter[81082:2398433] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating '(void 0).value')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating '(void 0).va..., stack:
<unknown>@349:437
y@61:1110
callTimers@61:3501
value@27:4290
<unknown>@27:1040
value@27:3717
value@27:1012

When you try

./symbolicate.js ios/main.jsbundle.map 349 437

you get the following

/react_native/react-native-typescript-starter/src/index.tsx:18:0

However this is wrong. The correct result should be

/react_native/react-native-typescript-starter/src/index.tsx:22:10

Its worth mentioning here that the results generated with bundle using --dev true are correct. The issue reproduces only with --dev false.

From the other comments, it looks like this issue is resolved. Could somebody point to me where am I going wrong? Thanks for the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shift the offset during eval (using sourcemap) - Stack Overflow
The problem is when I put a breakpoint or debugger inside the code, it stops two lines after the correct one because of...
Read more >
Source map line numbers mismatch (Angular) - Elastic Discuss
I am using Angular 9 and elastic/apm-rum-angular version 1.1.6. I uploaded the source maps generated by running "ng build --source-map".
Read more >
source-map - NPM Package Compare versions - Socket.dev
Start using Socket to analyze source-map and its 0 dependencies to secure your app from supply ... originalLine: The line number in the...
Read more >
What Are Source Maps and How to Properly Use Them
How to use javascript source map to debug compiled code. ... at the original source code including the original line numbers, column numbers...
Read more >
Source Maps - Rollbar Docs
Benefits of providing your source maps to Rollbar include: Stack traces will contain the original source filename, line number, method name, and code ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found