Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6211

Sentry: beforeSend is called mutliple times

$
0
0

I have a react-native app with redux. I want to fetch a PUT request with data when Sentry logs an error. I’m new in Sentry and I use this in my App.js:

Sentry.init({
  dsn: ...,
  enableInExpoDevelopment: true,
  debug: true,

  beforeSend(event) {
try {
  fetchMyData(data)
  Sentry.withScope(function(scope) {
    Sentry.captureMessage('Error');
  });
  return event;
}
catch (e) { 
  return e;
}
  },
});

It works and the request is successfull the most time, but beforeSend is called mutliple times and in Sentry the events loop: Put Request -> captureMessage -> Put Request -> captureMessage… and so on.

Is there another way for calling the method when Sentry logs? The data is only defined at the moment when beforeSend is called. why is there this loop?

Thank you!


Viewing all articles
Browse latest Browse all 6211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>