question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

beforeSend threw an error, will not send event

See original GitHub issue

Sentry SDK and version: “@sentry/browser”: “5.15.5”,

in index.js, which runs reactDOM.render:

import { init } from '@sentry/browser';

init({
	dsn: process.env.SENTRY_DSN,
	environment: process.env.NODE_ENV,
	release: process.env.SHORT_SHA,
	debug: true,
});

Debug output: image

It seems like init happens twice, or at least that the error logs are duplicated. I have ensured that all three env vars are defined and that I only call init once.

It’s a bit curious since I haven’t implemented my own beforeSend. If I implement beforeSend and log (event, hint), it’s not logged at all.

What is the cause of this error? Any ideas on how I can troubleshoot this?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
preciselywilliamcommented, May 26, 2020

Finally found the issue: our segment.io snippet made inited Sentry a second time. Thank you for helping with troubleshooting!!! @kamilogorek

0reactions
raid5commented, Jun 7, 2022

I upgraded from @sentry/react-native 1.2.0 to 3.4.3 and the issue went away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sentry BeforeSend not being triggered in Sentry.AspNetCore ...
Currently, BeforeSend only fires for error events, not for transactions, sessions, or other envelope types. However, in version 3.21.0 and ...
Read more >
How to use the @sentry/utils.logger.log function in ... - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... as Error, }); reject('`beforeSend` threw...
Read more >
Filtering for React | Sentry Documentation
beforeSend is called immediately before the event is sent to the server, so it's the final place where you can edit its data....
Read more >
JavaScript - Docs - Sentry Documentation
In most situations, you can capture errors automatically with ... Sentry.init({ beforeSend(event) { // Modify the event here if(event.user){ // Don't send ......
Read more >
jQuery.ajax() | jQuery API Documentation
A string containing the URL to which the request is sent. ... This is an Ajax Event. ... any malformed JSON is rejected...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found