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

Detox and Sentry.init integrations array cause timeout #4088

Open
6 tasks
estiventhneira opened this issue Sep 13, 2024 · 2 comments
Open
6 tasks

Detox and Sentry.init integrations array cause timeout #4088

estiventhneira opened this issue Sep 13, 2024 · 2 comments

Comments

@estiventhneira
Copy link

OS:

  • Windows
  • MacOS
  • [ x] Linux

Platform:

  • iOS
  • [ x] Android

SDK:

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

SDK version: ^5.31.1

react-native version: 0.71.11

Are you using Expo?

  • Yes
  • [x ] No

Are you using sentry.io or on-premise?

  • [x ] 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:
  enableNative: process.env.JEST ? false : true,
  attachScreenshot: true, 
  environment: __DEV__ ? "dev" : "prod",
  enableAutoSessionTracking: true,
  tracesSampleRate: 0.3,
  _experiments: {
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1.0,
  },
  integrations: [
    new Sentry.ReactNativeTracing({
      tracingOrigins: ["/.*.amazonaws.com.*/"],
    }),
    Sentry.mobileReplayIntegration({
      maskAllText: false,
      maskAllImages: false,
    }),
  ],
  beforeSend: async (event, hint) => {
    const error = hint.originalException;
    if (
      error &&
      error.message &&
      error.message.match(/Carton does not match any of the queued items/i)
    ) {
      return null;
    }
    console.log("Sentry event to send", event);
    await captureScreenshot(); // Capture a screenshot immediately
    if (attachments.length > 0) {
      console.log("SENTRY ATTACHMENTS", attachments);
      hint.attachments = attachments;

      // Clear the captured screenshots after attaching to the event
      capturedScreenshots = [];
      attachments = [];
    }
    return event;
  }
});

or

(react-native-sentry)

Sentry.config(
  'https://...@sentry.io/...'
  // other options
 ).install();

I have the following issue:

When trying to run detox test it get stuck waiting for a connection with sentry than makes timeout error:

13:50:39.972 detox[6080] i An error occurred while waiting for the app to become ready. Waiting for disconnection...
error: The pending request #-1000 ("isReady") has been rejected due to the following error:

Unresponded network requests might result in timeout errors in Detox tests.

13:50:45.081 detox[6080] i The pending request #-49642 ("cleanup") has been rejected due to the following error:

The tester has not received a response within 5000ms timeout to the message:

thrown: "Exceeded timeout of 120000 ms for a hook.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

Steps to reproduce:

  • Sentry.init with integrations array
  • Build and Run Detox test

Actual result:

Get timeout error

Expected result:

Be able to run the tests without commenting integrations arrays which is a workaround for it

this is related with integrations array as the solutions here works 13:50:39.972 detox[6080] i An error occurred while waiting for the app to become ready. Waiting for disconnection...
error: The pending request #-1000 ("isReady") has been rejected due to the following error:

@estiventhneira estiventhneira changed the title Detox and Sentry.init integrations Detox and Sentry.init integrations array cause timeout Sep 13, 2024
@krystofwoldrich
Copy link
Member

Hi @estiventhneira,
thank you for the message,

would you be able to share a reproducible example we could debug?


The ReactNativeTracing tracing integration is added by default when tracesSampleRate is set, so setting in integration array should not make a difference.

Does anything changes when only omitting the Replay integration?

@estiventhneira
Copy link
Author

I have to disabled tracesSampleRate too to avoid the error of detox getting stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Needs More Information
Development

No branches or pull requests

3 participants