Sentry
The `withSentry()` plugin for hot-updater enables automatic sourcemap upload to Sentry during the update bundle build process.
Prerequisites
- Sentry Account: Sign up here if you don't have one.
- Auth Token: Generate a token with the project:releases and org:read scopes from your Sentry dashboard.
- Complete the Sentry React Native SDK setup, including the
@sentry/react-nativeruntime package, native configuration, andSentry.init. Verify that your app reports a test error before adding OTA sourcemap uploads. - Install the plugin:
npm install @hot-updater/sentry-plugin --save-devStep 1: Configure Sentry
Configure Metro following the Sentry documentation. Keep your existing Metro customizations and apply withSentryConfig last.
const { getDefaultConfig } = require("@react-native/metro-config");
const { withSentryConfig } = require("@sentry/react-native/metro");
const config = getDefaultConfig(__dirname);
module.exports = withSentryConfig(config); Step 2: Wrap your build adapter
Use withSentry() to wrap any compatible build adapter such as bare.
import { existsSync } from "node:fs";
import { bare } from "@hot-updater/bare";
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
if (existsSync(".env.hotupdater")) {
process.loadEnvFile(".env.hotupdater");
}
export default defineConfig({
build: withSentry(
bare({
enableHermes: false,
// Required for sourcemap upload
sourcemap: true,
}),
{
// Your Sentry organization slug
org: "your-org-slug",
// Your Sentry project slug
project: "your-project",
authToken: process.env.SENTRY_AUTH_TOKEN!,
},
),
// .. your other config
});With a managed provider,
hot-updater init keeps this wrapped build when it updates the storage,
database, and plugins in hot-updater.config.ts.
Automatic Upload
withSentry() uploads one bundle and its sourcemap during hot-updater deploy,
using the Hermes sourcemap when available. Additional bundles or chunk maps,
such as split Re.Pack output, require separate uploads through Sentry's tooling.
Step 3: Deploy
Deploy the update to build the bundle and upload its sourcemaps to Sentry.
npx hot-updater deploy -iVerify symbolication
Install a release build, deploy a small JavaScript change with sourcemaps enabled, and trigger a controlled test error from the updated code. In your monitoring dashboard, confirm the stack points to the original source file and line in that update. A successful upload alone does not prove the app and uploaded map use the same identity.