Skip to content

sentry-miniapp跨端小程序 Sentry SDK

微信 / 支付宝 / 字节跳动 / 钉钉 / QQ / 百度 / 快手 + Taro / uni-app —— 异常、性能与网络监控开箱即用

sentry-miniapp

安装

bash
npm install sentry-miniapp --save
# 或 yarn add sentry-miniapp

一分钟接入

js
import * as Sentry from 'sentry-miniapp';

Sentry.init({
  dsn: 'https://your-dsn@o0.ingest.sentry.io/0',
  release: 'my-miniapp@1.0.0',
  environment: 'production',
});

// 之后未处理异常会自动上报;也可手动:
Sentry.captureException(new Error('test'));

接入前请确保 Sentry.initApp() 之前执行;自托管 / 真机时把 Sentry 域名加入小程序后台「合法域名」。详见 快速接入

基于 @sentry/core 的跨端小程序 SDK · MIT Licensed