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

@sentry/react - Uncaught TypeError: _a.getTransport is not a function #3995

Closed
4 of 9 tasks
ethanve opened this issue Sep 20, 2021 · 9 comments · Fixed by #4013
Closed
4 of 9 tasks

@sentry/react - Uncaught TypeError: _a.getTransport is not a function #3995

ethanve opened this issue Sep 20, 2021 · 9 comments · Fixed by #4013
Assignees

Comments

@ethanve
Copy link

ethanve commented Sep 20, 2021

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other: @sentry/react

Version:

6.13.1

Description

I'm seeing the following error consistently and can't seem to figure it out.

transaction.js:84 Uncaught TypeError: _a.getTransport is not a function
    at IdleTransaction.Transaction.finish (transaction.js:84)
    at IdleTransaction.finish (idletransaction.js:135)
    at idletransaction.js:82
    at sentryWrapped (helpers.js:72)

Link to event: https://sentry.io/organizations/eqtble/issues/2661337839/?project=5761814&query=is%3Aunresolved

@ethanve
Copy link
Author

ethanve commented Sep 20, 2021

I will note that all my dependencies in yarn.lock seem to be updated to 6.13.1

@AbhiPrasad
Copy link
Member

Thank you for reporting! It seems that that getTransport is not defined for some reason here.

this._hub
.getClient()
?.getTransport()
.recordLostEvent?.(Outcome.SampleRate, 'transaction');

@kamilogorek will defer to you to investigate further as this is a regression related to client outcomes.

@toniengelhardt
Copy link

Same here:

Screen Shot 2021-09-22 at 22 57 37

@kamilogorek
Copy link
Contributor

kamilogorek commented Sep 23, 2021

The only scenario when it can happen is either out-of-sync versions of our packages or having multiple instanced of the SDK used at the same time.

A trivial solution to this, if we decide to patch it (although I'd prefer to understand the culprit first) is to change

this._hub.getClient()?.getTransport().recordLostEvent?.(Outcome.SampleRate, 'transaction'); 
// to
this._hub.getClient()?.getTransport?.().recordLostEvent?.(Outcome.SampleRate, 'transaction'); 

@ethanve
Copy link
Author

ethanve commented Sep 23, 2021

The only scenario when it can happen is either out-of-sync versions of our packages or having multiple instanced of the SDK used at the same time.

@kamilogorek how can I confirm the above? I only see the latest version in yarn.lock and nothing else. I'm using sentry/React so would that have any issue?

@kamilogorek
Copy link
Contributor

If you are able to get a breakpoint at the place where it breaks, you can get the version of currently running SDK with Sentry.getCurrentHub().getClient().getOptions()._metadata.sdk.

@toniengelhardt
Copy link

toniengelhardt commented Sep 24, 2021

I'm using Nuxt and have "@nuxtjs/sentry": "^5.1.3" and "@sentry/tracing": "^6.13.2" in my package.json, both the latest version.

@kamilogorek
Copy link
Contributor

@nuxtjs/sentry is locked to 6.11.0, which doesnt have getTransport method on the client, that's why it's breaking - https://github.com/nuxt-community/sentry-module/blob/master/yarn.lock#L1707

If you are using yarn, you can confirm it by adding this to your package.json and running yarn again.

"resolutions": {
    "**/@sentry/browser": "^6.13.2"
},

@toniengelhardt
Copy link

Thanks @kamilogorek, I think it makes sense to implement the check you mentioned above since some packages might take a bit it update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants