Sentry-react-native: Unable to set environments on init

Created on 28 Jan 2020  路  3Comments  路  Source: getsentry/sentry-react-native

OS: MacOS

_Platform:_

  • [x ] iOS
  • [ x] Android

SDK:

  • [ x] @sentry/react-native

I have following issue:

You can't set a env for example I want one for development, QA and Prod using theses docs https://docs.sentry.io/enriching-error-data/environments/?platform=native

There doesn't seem to be a way to do this with this SDK? Is this going to be added soon?

Most helpful comment

I believe this could be done using addGlobalEventProcessor, for example:

Sentry.addGlobalEventProcessor((event, hint) => {
  event.environment = "QA";
  return event;
});

All 3 comments

I believe this could be done using addGlobalEventProcessor, for example:

Sentry.addGlobalEventProcessor((event, hint) => {
  event.environment = "QA";
  return event;
});

@wodCZ Amazing! It works thank you for this, I think this should be added to the docs

@ThomasLarge There is now property on Sentry.init({ environment: 'staging' }), which can set environment directly without mentioned workaround, but i suspect that somehow it does not work always, as i have some recent issues w/o environment set while all issues should have it. Do You still use workaround or You migrated to property of Sentry.init()?

Was this page helpful?
0 / 5 - 0 ratings