sentry-javascript: recordDroppedEvent is not a function

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/browser

SDK Version

7.6.0

Framework Version

@sentry/electron 3.0.7

Link to Sentry event

https://sentry.io/share/issue/25be96dd489041a4869bc487620e9d73/

Steps to Reproduce

Unfortunately we don’t have a clear way to reproduce it, but it seems to happen randomly at the time we span.finish() when making custom transactions and spans for performance.

Random guess, but do you think it could happen if we create multiple Transaction in parallel?

Expected Result

no crash should happen.

Actual Result

some error are getting thrown on some .finish() cases.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (11 by maintainers)

Most upvoted comments

I was able to fix my issue by downgrading to @sentry/nextjs: 6.19.2 and @sentry/tracing: 6.19.2 just like @gre did. There must be some issue with @sentry 7+ for next.js.

Thank you again!

Hey, guys. Same issue on my end. On dev server only.

"@sentry/react": "^7.16.0",
"@sentry/tracing": "^7.16.0",
Sentry.init({
    dsn: import.meta.env.VITE_SENTRY_DSN,
    integrations: [new BrowserTracing()],
    tracesSampleRate: 1.0,
    enabled: import.meta.env.PROD,
    release: import.meta.env.SENTRY_RELEASE,
});

File node_modules/@sentry/tracing/esm/transaction.js Line ~ 129

if (client) {
  client.recordDroppedEvent('sample_rate', 'transaction');
}

I see two different results on dev server and on local server. Local server doesn’t have this issue. Dev server does have.

So what’s the difference. I’ve added console.log(this._hub.getClient().__proto__.__proto__); before recordDroppedEvent call. To see instance which has to have this recordDroppedEvent method.

This is the list

captureEvent
captureException
captureMessage
captureSession
close
flush
getDsn
getIntegration
getIntegrationById - local only
getOptions
getTransport
recordDroppedEvent - local only <<<<<<<----------
sendEvent - local only
sendSession - local only
setupIntegrations
__init - local only
__init2 - local only
__init3 - local only
__init4 - local only
_applyClientOptions
_applyIntegrationsMetadata
_captureEvent
_clearOutcomes - local only
_getBackend - dev server only
_isClientDoneProcessing
_isEnabled
_normalizeEvent
_prepareEvent
_process
_processEvent
_sendEnvelope - local only
_sendEvent - dev server only
_sendSession - dev server only
_updateSessionFromEvent
constructor

How this can be fixed? Or at least catched properly 😃 Thx for help

It could also be the Vercel runtime environment. It is odd that the issue is never thrown in local development, even when running a build. It only occurs in a Vercel deployment.

I will continue to look into it. Thank you for your help!

I am also having this issue but for Next.JS. I think the same thing needs to be done with @sentry/nextjs that was done above for @sentry/electron.

I noticed however that this error only occurs when I implement Segment. Without segment it works final and does not produce this error.

My config: @sentry/nextjs: 7.8.0 @sentry/tracing: 7.8.0 @sentry/fullstory: 1.1.8 @segment/analytics-next: 1.41.1

Sentry issue: https://sentry.io/share/issue/176318dc0b9c4ff2b1312a23ff617675/

@gre The versions being used are 6.19.2. You can see them here: https://github.com/getsentry/sentry-electron/blob/1daad98a0b158baeadb8a9a28fdf61f8cbf2a1d0/package.json#L60-L64

So you’ll need @sentry/electron@3.0.7 and JS SDKs @ 6.19.2.