sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Sentry triggers fetching of source from bundler, but this returns a 404

Open nabati opened this issue 2 years ago • 4 comments

Environment

iOS Simulator Sentry SaaS.

react-native-sdk 3.2.3

Steps to Reproduce

For some reason, enabling sentry while enabling network inspect in react native debugger, I get a lot of false positives in the list of requested network resources. It seems Sentry initiates fetching the source for some files (?). When I disable Sentry, the requests and associated errors disappear.

It seems like Sentry is using trial and error to find the source code, and thus creating a lot of false positives in the logs?

image

Note that it also is successful in finding context.ts at some point.

Tested urls Failed http://localhost:8081//Users/xxxx/Projects/mevisio-native-app/src/context.ts http://localhost:8081/context.ts

Successful http://localhost:8081/src/context.ts

Expected Result

To not see these failed network requests when checking the network requests in react native debugger.

nabati avatar Nov 12 '21 09:11 nabati

@nabati thanks for reporting, is it debug or release mode? if debug, can you try release mode?

@jennmueng could it be related to https://github.com/getsentry/sentry-react-native/issues/1346 ?

marandaneto avatar Nov 12 '21 09:11 marandaneto

@marandaneto Yep, looks related to #1346. Looks like it's time we revisit the debug symbolicator integration.

jennmueng avatar Nov 17 '21 15:11 jennmueng

Could this be an issue of port forwarding, i.e.

adb reverse tcp:8080 tcp:8080

gives

Error: Unable to resolve module ./http://localhost:8081/index from /home/thomas/entur/git/abt-mobile-client-sdk/examples/client/.: 

None of these files exist:
  * http:/localhost:8081/index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  * ...

however http://localhost:8081/index.js does exist on my local developer machine. So this would indicate that the localhost in the above message is the Android device itself.

Workaround, add to sentry configuration:

integrations: function (integrations: any) { // see https://github.com/getsentry/sentry-react-native/issues/1346
    // filter default integrations
    return integrations.filter(function (integration:any) {
      return integration.name !== "DebugSymbolicator";
    });
  }

skjolber avatar Mar 11 '24 12:03 skjolber

Hi @skjolber, thank you for the message, the failing requests are caused by the DebugSymbolicator as mentioned above. By fetching the source context

https://github.com/getsentry/sentry-react-native/blob/395a14b289fce9cdff1e67433fccd855fc6e5632/src/js/integrations/debugsymbolicator.ts#L182-L191

krystofwoldrich avatar Mar 12 '24 16:03 krystofwoldrich