Skip to content

Event exception stacktrace selected frame (0) has incorrect abs_path (valid url is required). Found native #2921

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

Closed
5 of 11 tasks
Eden-Eliel opened this issue Mar 23, 2023 · 12 comments
Assignees

Comments

@Eden-Eliel
Copy link

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

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

SDK version: 5.2.0

react-native version: 0.70.5

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: config.SENTRY_DSN,
      release: getVersion(),
      dist: getBuildNumber(),
      environment: config.ENV_NAME === "Production"
          ? "production"
          : "qa",
      integrations: [
          new Sentry.ReactNativeTracing({
              routingInstrumentation
          }),
      ],
});

I have following issue:

Hey,
I'm trying to get the iOS on our app to work with source maps, however, I encounter some errors when trying to look at the error.
The output of the explain of this:

✔ Fetched data for event: a257684de1db4630b69475cc212bba02
✔ Event has release name: 7.2.3
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
✖ Event exception stacktrace selected frame (0) has incorrect abs_path (valid url is required). Found native

I assume it relates to some issues mentioned here:
#2891
#2683 (comment)

One of the frames in the issue is:
{"function":"apply","filename":"native","abs_path":"native","in_app":true}

which I assume is the cause of this issue, but I thought the new version (5.2.0) should fix it.
Any suggestion?

Actual result:

✔ Fetched data for event: a257684de1db4630b69475cc212bba02
✔ Event has release name: 7.2.3
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
✖ Event exception stacktrace selected frame (0) has incorrect abs_path (valid url is required). Found native

Expected result:

✔ Fetched data for event: 091e863ca2724cb6995b030e65e918ec
✔ Event has release name: 7.2.3
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
⚠ Exception is already source mapped and first resolved frame points to:

                       handleComponent={handleComponent}
                       onAnimate={onSheetAnimate}
                       {...props}
          >
              <RectButton onPress={() => {
>                 throw new Error("Some Flaysh Error!!!")
              }}>
                  Eden
              </RectButton>
              <RectButton onPress={() => {
                  JSON.parse("Flaysh")

Thanks ahead, Eden.

@Eden-Eliel
Copy link
Author

Update:
I have tried to change the abs_path just to check if it would give other issue:

if (frame.abs_path === 'native') {
    frame.abs_path = '[native-code]'
}
Event exception stacktrace selected frame (0) has incorrect abs_path (valid url is required). Found [native-code]

so it's absolutely this frame.
I suspect that with one of the integrations if the abs_path is missing (after the delete frame.abs_path) it will add it anyway. (Alone the integration works fine)

@Eden-Eliel
Copy link
Author

Eden-Eliel commented Mar 24, 2023

Another Update:
i have made an integration that will override the native abs_path so it will not fail:

integrations: [
                    new RewriteFrames({
                        iteratee: (frame) => {
                            if (frame.filename) {
                                frame.filename = frame.filename
                                    .replace(/^file:\/\//, '')
                                    .replace(/^address at /, '')
                                    .replace(/^.*\/[^.]+(\.app|CodePush|.*(?=\/))/, '');
                                if (frame.filename !== '[native code]' &&
                                    frame.filename !== 'native') {
                                    const appPrefix = 'app://';
                                    // We always want to have a triple slash
                                    frame.filename =
                                        frame.filename.indexOf('/') === 0
                                            ? `${appPrefix}${frame.filename}`
                                            : `${appPrefix}/${frame.filename}`;
                                    delete frame.abs_path;
                                }
                            }

                            if (frame.abs_path === 'native') {
                                frame.abs_path = isIos ? 'app:///main.jsbundle' : 'app:///index.android.bundle';
                            }
                            return frame
                        }
                    }),
                    new Sentry.ReactNativeTracing({
                        routingInstrumentation
                    }),
                ],

And this is my result now:

✔ Fetched data for event: 25bdc397551c4b05a3dbdb45faef7a9a
✔ Event has release name: 7.2.3
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
⚠ Exception is already source mapped and first resolved frame points to:

> [missing context line]

seems like something that was mentioned here but in react native we are not using webpack

following command on generating sourcemap (iOS), which as i understand do not need the .hbc.map thing:

node_modules/.bin/react-native bundle \
  --dev false \
  --platform ios \
  --entry-file index.js \
  --bundle-output sourcemaps/ios/main.jsbundle \
  --sourcemap-output sourcemaps/ios/main.jsbundle.map \
  --minify false

Hope it helps figure out my issue.

@krystofwoldrich
Copy link
Member

Thank you for all the details, we will take a look into it.

@krystofwoldrich
Copy link
Member

The reason why you get > [missing context line] after applying your fix is that you trying to process the native code stack trace frame as it would be js code. Only the JS frames can be mapped.

I've checked the mentioned event ✔ Fetched data for event: a257684de1db4630b69475cc212bba02 its tagged release:7.2.3, but this release has no source maps artifacts. Can you check your build logs that the source maps are uploaded or upload the source maps manually?

@krystofwoldrich krystofwoldrich moved this from Needs Investigation to Needs More Information in [DEPRECATED] Mobile SDKs Mar 24, 2023
@Eden-Eliel
Copy link
Author

The reason why you get > [missing context line] after applying your fix is that you trying to process the native code stack trace frame as it would be js code. Only the JS frames can be mapped.

I've checked the mentioned event ✔ Fetched data for event: a257684de1db4630b69475cc212bba02 its tagged release:7.2.3, but this release has no source maps artifacts. Can you check your build logs that the source maps are uploaded or upload the source maps manually?

Thanks for the replay,
Yea it makes sense because I always removed the sourcemaps haha.

However, I used the automatic upload and everything looks fine.

If you want to keep it and try to figure out why it happened, I can upload everything manually again, I don't mind.

Lemme know if you want to close it, or keep investigating the manual upload

@krystofwoldrich
Copy link
Member

@Eden-Eliel Okay, that makes sense, could you upload the source maps (and keep them) and send us a link to a new error?

@krystofwoldrich
Copy link
Member

Closing this due to inactivity. If this is still an issue feel free to comment here or open a new issue if the context changed.

@krystofwoldrich krystofwoldrich closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2023
@github-project-automation github-project-automation bot moved this from Needs More Information to Done in [DEPRECATED] Mobile SDKs Apr 12, 2023
@dmregister
Copy link

dmregister commented May 4, 2023

@krystofwoldrich we are having the same issue with sourcemaps not being applied errors. Here is the output of the explain command:

✔ Fetched data for event: 123
✔ Event has release name: ###@#.#.#+407600003
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
✖ Event exception stacktrace selected frame (0) has incorrect abs_path (valid url is required). Found native

The only thing that changed was we updated our packages from 5.1.1 to 5.3.1. When I downloaded the arifacts and re-uploaded them using the same cmds but with the latest CLI, I am not seeing the source maps being applied to new events.

@krystofwoldrich
Copy link
Member

krystofwoldrich commented May 5, 2023

@dmregister Can you try this with the latest SDK version, https://github.com/getsentry/sentry-react-native/releases/tag/5.4.1? Could you share the raw stack trace?

@dmregister
Copy link

I did just update to 5.4.1 and I think I saw it was corrected. I updated after I saw this issue: #3010

Here is the raw stack:

Error: Unexpected token T in JSON at position 376
  at call(native)
  at ApolloError(app:///index.android.bundle:1:1866725)
  at anonymous(app:///index.android.bundle:1:1880512)
  at anonymous(app:///index.android.bundle:1:1882040)
  at anonymous(app:///index.android.bundle:1:1881451)
  at anonymous(app:///index.android.bundle:1:1874776)
  at useDeepMemo(app:///index.android.bundle:1:1874106)
  at useBaseQuery(app:///index.android.bundle:1:1874566)
  at useQuery(app:///index.android.bundle:1:1875270)
  at useExampleQuery(app:///index.android.bundle:1:4708754)
  at ExampleProvider(app:///index.android.bundle:1:6768839)
  at renderWithHooks(app:///index.android.bundle:1:306544)
  at updateForwardRef(app:///index.android.bundle:1:311595)
  at beginWork$1(app:///index.android.bundle:1:347667)
  at performUnitOfWork(app:///index.android.bundle:1:334914)
  at workLoopSync(app:///index.android.bundle:1:334771)
  at renderRootSync(app:///index.android.bundle:1:334655)
  at performSyncWorkOnRoot(app:///index.android.bundle:1:332071)
  at flushSyncCallbacks(app:///index.android.bundle:1:296448)
  at scheduleUpdateOnFiber(app:///index.android.bundle:1:328974)
  at dispatchReducerAction(app:///index.android.bundle:1:309853)
  at tryCallOne(app:///index.android.bundle:1:357378)
  at anonymous(app:///index.android.bundle:1:358054)
  at apply(native)
  at anonymous(app:///index.android.bundle:1:369752)
  at _callTimer(app:///index.android.bundle:1:368701)
  at _callReactNativeMicrotasksPass(app:///index.android.bundle:1:368865)
  at callReactNativeMicrotasks(app:///index.android.bundle:1:370845)
  at __callReactNativeMicrotasks(app:///index.android.bundle:1:271417)
  at anonymous(app:///index.android.bundle:1:270509)
  at __guard(app:///index.android.bundle:1:271258)
  at flushedQueue(app:///index.android.bundle:1:270420)
  at invokeCallbackAndReturnFlushedQueue(app:///index.android.bundle:1:270363)

@krystofwoldrich
Copy link
Member

@dmregister So just to double-check with the 5.4.1 the stack traces are symbolicated correctly?

@dmregister
Copy link

@krystofwoldrich yes it did, thanks for following up.

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

No branches or pull requests

3 participants