@amazon-devices/sentry__react-native library implements the React Native SDK for Sentry on the Vega platform.
During this phase, some of the Sentry features aren’t setup for Vega. You can post questions or report issues on the Vega Developer Forums.
Installation
-
Add the JavaScript library dependency in the
package.jsonfile. -
Install dependencies using the
npm installcommand.
Examples
Initialize Sentry on the top-level of you app. To initialize Sentry use theSentry.init({...}) method. The only required parameter is the dsn, short for Data Source Name. Find the dsn from the Sentry project’s settings page.
Sentry.setContext() or Sentry.setUser(), as shown in the following example.
API reference
Sentry.init(options: ReactNativeOptions)- Initializes Sentry. After calling it, all errors get reported by Sentry. If your application crashes or throws uncaught exception before the call toSentry.init(), the error won’t be caught by Sentry.Sentry.nativeCrash()- Triggers the native crash, tested, and verified to work on Vega devices and simulator.Sentry.setUser(user: User)- Sets user data (for example,username,email) that is included in Sentry events.Sentry.setContext(contextKey: string, contextData: Object)- Sets custom data to be added under the passedcontextKeythat is included in Sentry events.Sentry.flush()- Wait for all Sentry events to be sent.Sentry.captureMessage(message: string)- Captures a message event and sends it to Sentry.Sentry.captureException(exception: Error)- Captures an exception event and sends it to Sentry.
Additional configurations
Add readable stack traces to Sentry errors
After the app is built, you need to notify Sentry about the app release name, version, and dist number and send sourcemaps of the JavaScript bundle and debug files. This ensures that Sentry catches events and correctly maps the information with readable stack traces. After building the app, the folder structure might look like this:-
In the Sentry initialization, create a release version and a dist version. Define
$SENTRY_RELEASE_VERSION(for example,my-kepler-project@2.3.12) and$SENTRY_DIST_NUMBER(for example52). See Sentry official docs for more information. -
Add Sentry Metro Serializer to
metro.config.jsand rebuild the application. -
Install
sentry-cli. See Sentry official docs for more information. -
Create a new Sentry release. You need to pass the previously defined
$SENTRY_RELEASE_VERSION. See Sentry official docs for more information. -
Upload source maps for JavaScript symbolication. Note that
sentry-wizardis not yet supported. See Sentry official docs for more information.
Implementation details
sentry-wizardand the SentryReact Native Metro Pluginare not yet supported.@sentry/wizarddoesn’t work on Vega projects.withSentryConfigmetro tool doesn’t work on Vega projects.Tracingisn’t implemented.Profilingisn’t implemented.
Known issues and limitations
Sentry offline support isn’t working on Vega.Sentry.init() is missing options.

