HotupdaterHot Updater
Integration Plugins

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

Step 1: Configure Sentry

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);

You need to configure Re.Pack.

npm install repack-plugin-sentry
rspack.config.mjs
import { SentryDebugIdPlugin } from "repack-plugin-sentry";

export default {
  // ... your other config
  plugins: [
    // ... your other plugins
    new SentryDebugIdPlugin(), 
  ],
};

Step 2: Wrap Your Build Plugin

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

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

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

config({ path: ".env.hotupdater" });

export default defineConfig({
  build: withSentry(
    bare({
      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
});
hot-updater.config.ts
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
import { expo } from "@hot-updater/expo";

export default defineConfig({
  build: withSentry(
    expo({
      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
});
hot-updater.config.ts
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
import { rock } from "@hot-updater/rock";

export default defineConfig({
  build: withSentry(
    rock({
      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 deploy process.

Step 3: Deploy

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

npx hot-updater deploy -i