Setting Up Sentry
In the app SentryBy integrating Sentry, you can automatically detect and monitor errors that occur in JavaScript. This helps improve app stability and provides users with a better experience.
1. Initial Sentry setup
Sentry official guidePlease refer to it to initialize Sentry in the app.
In the Apps in Toss environment, native error tracking cannot be used, so enableNative the option falsemust be set to.
import * as Sentry from '@sentry/react-native';
Sentry.init({
// ...
enableNative: false,
});2. Install the Sentry plugin
In the project root directory, run the command appropriate for your package manager to install the Sentry plugin.
npm install @granite-js/plugin-sentrypnpm install @granite-js/plugin-sentryyarn add @granite-js/plugin-sentry3. Configure the plugin
The installed @granite-js/plugin-sentryto granite.config.ts in the file plugins Add it to the item. In the Apps in Toss environment, useClient the option must be falseset tomust be.
4. Launch the app
For how to launch the app, Mini app launch please refer to the documentation.
5. Upload sourcemaps to Sentry
To accurately track errors in the launched mini app, the generated after build upload the sourcemap to Sentrymust be.
If you run the command below, the sourcemap will be uploaded.
After running the command, you will be prompted to enter Sentry's organization (Org), project (Project), and authentication token. Once you enter all the information, the service's sourcemap will be uploaded to Sentry.