Sentry-javascript: Browser tags not sent anymore with BrowserClient initialization

Created on 17 Jun 2020  路  7Comments  路  Source: getsentry/sentry-javascript

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);
Confirmed In Progress

Most helpful comment

@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 - https://github.com/getsentry/sentry-javascript/pull/2665 (release is pending, so should be available early next week).

All 7 comments

Problem keeps occuring with last version 5.17.0.

@Mattgic shouldn't your code be

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

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.

@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 - https://github.com/getsentry/sentry-javascript/pull/2665 (release is pending, so should be available early next week).

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

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

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

Was this page helpful?
0 / 5 - 0 ratings