I am using React Native SDK and migrating from v7 to v8.
I want to use Capture App Start Errors feature which requires to create a sentry.options.json file.
The json payloads needs "dsn" and "environment", but these values are stored .env files to build in different environments. (ex: production and staging)
Can I create different sentry.options.json for different environment? If so, how do I implement it?
#How to setup React Native's sentry.options.json based on .env?
3 messages · Page 1 of 1 (latest)
Thank you for raising this @subtle goblet 🙇♂️
We do not currently support this but it should be possible by creating environment-specific files and copying them before building. Something like:
{
"scripts": {
"prebuild:prod": "cp sentry.options.production.json sentry.options.json",
"prebuild:staging": "cp sentry.options.staging.json sentry.options.json"
}
}
Not that we will investigate a better approach to this as part of https://github.com/getsentry/sentry-react-native/issues/5779
Thanks for your reply and a proposed workaround. I will follow the GitHub issue for updates. 🙏