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!