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

Browser tags not sent anymore with BrowserClient initialization #2678

Closed
3 of 4 tasks
Mattgic opened this issue Jun 17, 2020 · 7 comments
Closed
3 of 4 tasks

Browser tags not sent anymore with BrowserClient initialization #2678

Mattgic opened this issue Jun 17, 2020 · 7 comments

Comments

@Mattgic
Copy link

Mattgic commented Jun 17, 2020

Package + Version

  • [ 5.15.0] @sentry/browser
  • [ 5.15.0] @sentry/hub

Description

On Sentry we don't get browser tags (browser, os and device data) on events since the update of @sentry/browser to version 5.15.0. It works with version 5.14.2.
In the request payload, the request key doesn't exist anymore, so useragent isn't sent.
Sentry is initialized creating manually new BrowserClient & new Hub. Initializating Sentry with Sentry.init fixes the problem, but we intend to have multiple initialization on the page so this is not a solution.

const integrations: Integration[] = [...defaultIntegrations, new ExtraErrorData(), new Dedupe()];
const environment = guessEnvironment();
if (environment !== ENV.PRODUCTION) {
  integrations.push(new Debug());
}
const client = new BrowserClient({
  dsn: '******,
  release: guessRelease(),
  environment,
  integrations,
  enabled: true,
});
hub = new Hub(client);
makeMain(hub);
@Mattgic
Copy link
Author

Mattgic commented Jun 17, 2020

Problem keeps occuring with last version 5.17.0.

@JustFly1984
Copy link

@Mattgic shouldn't your code be

if (environment !== NODE_ENV.PRODUCTION) { instead of if (environment !== ENV.PRODUCTION) { ?

@Mattgic
Copy link
Author

Mattgic commented Jun 17, 2020

I have

const ENV = {
  LOCAL_DEV: 'dev',
  USINE: 'usine',
  RECETTE: 'recette',
  INTEG: 'integration',
  PRODUCTION: 'production',
};

on top I didn't paste here ;)
guessEnvironment() computes environment from hostname.

@kamilogorek
Copy link
Contributor

@Mattgic you need to call hub.bindClient(client) after creating a hub. It was an oversight on our side and it has been already fixed - #2665 (release is pending, so should be available early next week).

@Mattgic
Copy link
Author

Mattgic commented Jun 17, 2020

Wow. It works, thanks a lot :) Should have asked earlier 😄

@kamilogorek
Copy link
Contributor

Awesome, will let you know once 5.18 is released :)

@AbhiPrasad
Copy link
Member

5.18.0 has been released, see the CHANGELOG here: https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#5180.

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

No branches or pull requests

4 participants