Skip to content

Conversation

@kamilogorek
Copy link
Contributor

@kamilogorek kamilogorek commented Oct 29, 2020

This can happen when malformed node_modules are using older version of hub, but core wants to call that method. Or when there are 2 versions of Sentry living next to each other for some unknown reason. Fix is straightforward enough that I'm fine to include it, and we already got 2 customers reporting this issue.

@github-actions
Copy link
Contributor

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 19.63 KB (+0.04% 🔺)
@sentry/browser - Webpack 20.47 KB (+0.02% 🔺)
@sentry/react - Webpack 20.47 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 26.62 KB (+0.03% 🔺)

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kamilogorek kamilogorek merged commit bd6028a into master Oct 29, 2020
@kamilogorek kamilogorek deleted the fix-get-session branch October 29, 2020 14:53
@rpastorelle
Copy link

rpastorelle commented Nov 3, 2020

👋 we upgraded to 5.27.2 this week and we see this issue currently.

Wondering if this didn't quite fix (seems like it should have 🤷)

Screen Shot 2020-11-03 at 2 22 36 PM

Or maybe this fix hasn't been pushed everywhere yet? It doesn't seem to be in https://browser.sentry-cdn.com/5.27.2/bundle.min.js

}

const session = scope && scope.getSession();
const session = scope && scope.getSession && scope.getSession();
Copy link

@MrChocolatine MrChocolatine Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about simply using ?.? (same comment for the second file in this PR)

const session = scope && scope.getSession?.();

Is its compatibility enough for you?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining#Browser_compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could do that, as we're compiling it down to ES5 anyway. Good catch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that matter, couldn't we just do

const session = scope?.getSession?.();

?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants