Skip to content

"Java exception was raised during method invocation" error after React navigation on Android OS with FacebookMobile brwoser #15065

Closed
@eshelsil

Description

@eshelsil

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

7.93.0

Framework Version

18.2.0

Link to Sentry event

https://carefam.sentry.io/issues/6213106599/events/1a108b7f986349929f9de9866abdcb10/

Reproduction Example/SDK Setup

function SentryController({ children }: { children: ReactNode }) {
    useEffect(() => {
        if (config.ENV === Env.Dev && !config.DEV_TEST_SENTRY_ON_DEV) {
            return;
        }
        const isInitialized = Sentry.getClient() !== undefined;
        if (isInitialized) {
            return;
        }
        Sentry.init({
            dsn: config.SENTRY_DSN,
            integrations: [
                Sentry.browserTracingIntegration(),
                Sentry.replayIntegration({
                    maskAllText: false,
                }),
            ],
            tracesSampleRate: config.ENV === Env.Dev ? 1.0 : 0.1,
            replaysSessionSampleRate: config.ENV === Env.Dev ? 0 : 0.5,
            replaysOnErrorSampleRate: config.ENV === Env.Dev ? 0 : 1.0,
            tracePropagationTargets: [
                'localhost',
                `https://${config.PROD_URL}`,
                `https://${config.STAGING_URL}`,
            ],
            environment: config.ENV,
        });
        Sentry.setTag('session', getSessionId());
    }, []);

    return (
        <Sentry.ErrorBoundary fallback={ErrorFallbackView}>
            {children}
        </Sentry.ErrorBoundary>
    );
}

Steps to Reproduce

  1. implement logic that uses react navigation immediately on page visit (based on localStorage for example)
  2. visit the page using Android Device with Facebook-Mobile browser
  3. most of the time it will trigger this issue ( at least in my usecase)

Expected Result

  • Triggering error should be visible on the Sentry Issue, instead of generic error raised by Sentry lib: "Java exception was raised during method invocation"
  • StackTrace should show the lines in code that have triggered the error (and not only Sentry lib code)

Actual Result

Getting multiple errors on Sentry.
Only on FacebookMobile browser on Andorid OS
The error is triggered from Sentry lib, so it is too generic to archive:

Issue Title:
Error
Object.init()

Error:
Java exception was raised during method invocation

StackTrace:
in Object.init at line 37:42346
In App
at line 37:40603
In App
../../node_modules/@sentry/browser/esm/helpers.js in sentryWrapped at line 97:17

  // Attempt to invoke user-land function
  // NOTE: If you are a Sentry user, and you are seeing this stack frame, it
  //       means the sentry.javascript SDK caught an error invoking your application code. This
  //       is expected behavior and NOT indicative of a bug with sentry.javascript.
  return fn.apply(this, wrappedArguments);    ---> // executed line
} catch (ex) {
  ignoreNextOnError();
  withScope(scope => {
    scope.addEventProcessor(event => {

This error happens immediately after navigation (auto navigation triggered by business logic, not by user click).
The user UX is unaffected, so this is just noise that Sentry is creating for us, and no safe way to ignore it.

Any help here?
Did anyone experienced a similar issue?

Metadata

Metadata

Assignees

Labels

Package: reactIssues related to the Sentry React SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions