Sentry Source Maps Plugin

The withSentry() plugin for hot-updater enables automatic sourcemap upload to Sentry during the update bundle build process.

This helps you track production crashes with accurate stack traces tied to your React Native source code.

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.
  • Install the plugin:
npm
pnpm
yarn
npm install @hot-updater/sentry-plugin @sentry/cli --save-dev

Step 1: Configure Sentry

https://docs.sentry.io/platforms/react-native/manual-setup/metro/

You need to configure Metro. Please refer to the Sentry documentation above for detailed setup instructions.

metro.config.js
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 Plugin

Use withSentry() to wrap any compatible build plugin such as metro.

Once wrapped, sourcemaps will automatically be uploaded to Sentry when running the hot-updater deploy process.

hot-updater.config.ts
import { metro } from "@hot-updater/metro";
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
import "dotenv/config";

export default defineConfig({
  build: withSentry(
    metro({
      enableHermes: false,
      sourcemap: true, Required for sourcemap upload
    }),
    {
      org: "your-org-slug",       Your Sentry organization slug
      project: "your-project",    Your Sentry project slug
      authToken: process.env.SENTRY_AUTH_TOKEN!, 
    },
  ),
  // .. your other config
});
Automatic Upload

When withSentry() wraps your build plugin, all generated sourcemaps are uploaded to Sentry automatically during the hot-updater deployprocess.

Step 3: Deploy

Now, every time you deploy, sourcemaps will be automatically uploaded to Sentry.

npm
pnpm
yarn
npx hot-updater deploy -i