Skip to content

[v8.x.x] useNativeInit with Expo CNG #5661

@huextrat

Description

@huextrat

Description

The Expo setup documentation states that when useNativeInit is set to true, the Expo plugin automatically:

When useNativeInit is set to true, the Expo plugin automatically:
Creates sentry.options.json from your Expo config
Adds RNSentrySDK.init() to your Android MainApplication
Adds RNSentrySDK.start() to your iOS AppDelegate

In practice, the plugin does add the native init calls and writes sentry.properties (for build-time: org, project, url, auth), but it does not create sentry.options.json, which is what the native SDK reads at runtime for DSN and other options.

Questions

  1. Do we need to create sentry.options.json ourselves when using useNativeInit: true with the Expo plugin, with the required fields (e.g. DSN and any other runtime options)? If yes, could this be clarified in the docs and/or could the Expo plugin accept these options and generate sentry.options.json from them (e.g. pass dsn and any other needed options in the plugin config so we don’t have to maintain a separate file)?

  2. Plugin form vs withSentry()

The docs show the plugin in array form: https://docs.sentry.io/platforms/react-native/manual-setup/app-start-error-capture/:

 [
     "@sentry/react-native/expo",
     {
       "useNativeInit": true
     }
   ]

but Expo setup doc https://docs.sentry.io/platforms/react-native/manual-setup/expo/:

import { withSentry } from "@sentry/react-native/expo";
   export default withSentry(config, {
     url: "https://sentry.io/",
     project: "X",
     organization: "X",
     useNativeInit: true,
   });

Are these two approaches equivalent (same plugin, same behavior), or is there a functional difference between registering the plugin via the plugins array vs wrapping the config with withSentry()?

Metadata

Metadata

Assignees

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions