Token导航 LogoToken导航

Agent Skill · 研究检索

sentry-browser-sdk(Sentry 浏览器 SDK)

sentry-browser-sdk 用于处理浏览器自动化、网页检查和页面信息提取,适合在 Codex、Claude、Cursor、Gemini CLI 中需要让 Agent 打开页面、读取网页或验证前端流程时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

sentry-browser-sdk 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 7,257。

总安装 19,531周安装 822GitHub Stars 156下载 6,839核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sentry-browser-sdk(Sentry 浏览器 SDK)
来源仓库:https://github.com/getsentry/sentry-for-ai
仓库路径:skills/sentry-browser-sdk
安装命令:
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-browser-sdk
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-browser-sdk

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于处理浏览器自动化、网页检查和页面信息提取。适合在需要打开页面、读取内容或验证前端流程时使用。可结合来源仓库和原始 README 继续核验具体用法。安装前建议确认权限范围和维护状态,避免意外联网或文件操作。注意操作边界,防止越权访问或数据泄露。

sentry-browser-sdk 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/sentry-browser-sdk

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-browser…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

sentry-browser-sdk 怎么安装?

在终端执行 npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-browser-sdk。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

sentry-browser-sdk 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

sentry-browser-sdk 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

sentry-browser-sdk 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

sentry-browser-sdk 用的人多吗?

公开数据是累计安装 19,531 次,近一周安装 822 次,下载 6,839 次,GitHub 156 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

sentry-browser-sdk 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
sentry-browser-sdk

Sentry 浏览器 SDK · 本页

19,531156接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

All Skills > SDK Setup > Browser SDK

Sentry Browser SDK

Opinionated wizard that scans your project and guides you through complete Sentry setup for browser JavaScript — vanilla JS, jQuery, static sites, WordPress, and any JS project without a framework-specific SDK.

Invoke This Skill When

  • User asks to "add Sentry to a website" or set up Sentry for plain JavaScript
  • User wants to install @sentry/browser or configure the Loader Script
  • User has a WordPress, Shopify, Squarespace, or static HTML site
  • User wants error monitoring, tracing, session replay, or logging without a framework
  • No framework-specific SDK applies
Note: SDK versions and APIs below reflect @sentry/browser ≥10.0.0. Always verify against docs.sentry.io/platforms/javascript/ before implementing.

Phase 1: Detect

CRITICAL — Check for frameworks first. Framework-specific SDKs provide significantly better coverage and must be recommended before proceeding with @sentry/browser.

Step 1A: Framework Detection (Redirect If Found)

# Check for React
cat package.json 2>/dev/null | grep -E '"react"'

# Check for Next.js
cat package.json 2>/dev/null | grep '"next"'

# Check for Vue
cat package.json 2>/dev/null | grep '"vue"'

# Check for Angular
cat package.json 2>/dev/null | grep '"@angular/core"'

# Check for Svelte / SvelteKit
cat package.json 2>/dev/null | grep -E '"svelte"|"@sveltejs/kit"'

# Check for Remix
cat package.json 2>/dev/null | grep -E '"@remix-run/react"|"@remix-run/node"'

# Check for Nuxt
cat package.json 2>/dev/null | grep '"nuxt"'

# Check for Astro
cat package.json 2>/dev/null | grep '"astro"'

# Check for Ember
cat package.json 2>/dev/null | grep '"ember-source"'

# Check for Node.js server frameworks (wrong SDK entirely)
cat package.json 2>/dev/null | grep -E '"express"|"fastify"|"@nestjs/core"|"koa"'

If a framework is detected, stop and redirect:

Framework detectedRedirect to
nextLoad sentry-nextjs-sdk skill — do not proceed here
react (without Next.js)Load sentry-react-sdk skill — do not proceed here
vueSuggest @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/
@angular/coreSuggest @sentry/angular — see docs.sentry.io/platforms/javascript/guides/angular/
@sveltejs/kitLoad sentry-svelte-sdk skill — do not proceed here
svelte (SPA, no kit)Suggest @sentry/svelte — see docs.sentry.io/platforms/javascript/guides/svelte/
@remix-runSuggest @sentry/remix — see docs.sentry.io/platforms/javascript/guides/remix/
nuxtSuggest @sentry/nuxt — see docs.sentry.io/platforms/javascript/guides/nuxt/
astroSuggest @sentry/astro — see docs.sentry.io/platforms/javascript/guides/astro/
ember-sourceSuggest @sentry/ember — see docs.sentry.io/platforms/javascript/guides/ember/
express / fastify / @nestjs/coreThis is a Node.js server — load sentry-node-sdk or sentry-nestjs-sdk skill
Why redirect matters: Framework SDKs add router-aware transactions, error boundaries, component tracking, and often SSR coverage. Using @sentry/browser directly in a React or Next.js app loses all of that.

Only continue with @sentry/browser if no framework is detected.

Step 1B: Installation Method Detection

# Check if there's a package.json at all (bundler environment)
ls package.json 2>/dev/null

# Check package manager
ls package-lock.json yarn.lock pnpm-lock.yaml bun.lockb 2>/dev/null

# Check build tool
ls vite.config.ts vite.config.js webpack.config.js rollup.config.js esbuild.config.js 2>/dev/null
cat package.json 2>/dev/null | grep -E '"vite"|"webpack"|"rollup"|"esbuild"'

# Check for CMS or static site indicators
ls wp-config.php wp-content/ 2>/dev/null   # WordPress
ls _config.yml _config.yaml 2>/dev/null    # Jekyll
ls config.toml 2>/dev/null                 # Hugo
ls .eleventy.js 2>/dev/null                # Eleventy

# Check for existing Sentry
cat package.json 2>/dev/null | grep '"@sentry/'
grep -r "sentry-cdn.com\|js.sentry-cdn.com" . --include="*.html" -l 2>/dev/null | head -3

What to determine:

QuestionImpact
package.json exists + bundler?→ Path A: npm install
WordPress, Shopify, static HTML, no npm?→ Path B: Loader Script
Script tags only, no Loader Script access?→ Path C: CDN bundle
Already has @sentry/browser?Skip install, go straight to feature config
Build tool is Vite / webpack / Rollup / esbuild?Source maps plugin to configure

Phase 2: Recommend

Present a recommendation based on what you found. Lead with a concrete proposal, don't ask open-ended questions.

Recommended (core coverage):

  • ✅ Error Monitoring — always; captures unhandled errors and promise rejections
  • ✅ Tracing — recommended for any interactive site; tracks page load and user interactions
  • ✅ Session Replay — recommended for user-facing apps; records sessions around errors

Optional (enhanced observability):

  • ⚡ User Feedback — capture reports directly from users after errors
  • ⚡ Logging — structured logs via Sentry.logger.*; requires npm or CDN logs bundle (not available via Loader Script)
  • ⚡ Profiling — JS Self-Profiling API; beta, Chromium-only, requires Document-Policy: js-profiling response header

Feature recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
TracingAlways for interactive pages — page load + navigation spans are high-value
Session ReplayUser-facing app, support flows, or checkout pages
User FeedbackSupport-focused app; want in-app bug reports with screenshots
LoggingStructured log search or log-to-trace correlation needed; npm path only
ProfilingPerformance-critical, Chromium-only app; Document-Policy: js-profiling header required

Installation path recommendation:

ScenarioRecommended path
Project has package.json + bundlerPath A (npm) — full features, source maps, tree-shaking
WordPress, Shopify, Squarespace, static HTMLPath B (Loader Script) — zero build tooling, always up to date
Static HTML without Loader Script accessPath C (CDN bundle) — manual <script> tag

Propose: *"I recommend setting up Error Monitoring + Tracing + Session Replay using Path A (npm). Want me to also add Logging or User Feedback?"*


Phase 3: Guide

Path A: npm / yarn / pnpm (Recommended — Bundler Projects)

Install
npm install @sentry/browser --save
# or
yarn add @sentry/browser
# or
pnpm add @sentry/browser
Create src/instrument.ts

Sentry must initialize before any other code runs. Put Sentry.init() in a dedicated sidecar file:

import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: import.meta.env.VITE_SENTRY_DSN, // Adjust per build tool (see table below)
  environment: import.meta.env.MODE,
  release: import.meta.env.VITE_APP_VERSION, // inject at build time

  sendDefaultPii: true,

  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.replayIntegration({
      maskAllText: true,
      blockAllMedia: true,
    }),
  ],

  // Tracing
  tracesSampleRate: 1.0, // lower to 0.1–0.2 in production
  tracePropagationTargets: ["localhost", /^https:\/\/yourapi\.io/],

  // Session Replay
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,

  enableLogs: true,
});

DSN environment variable by build tool:

Build ToolVariable NameAccess in code
ViteVITE_SENTRY_DSNimport.meta.env.VITE_SENTRY_DSN
Custom webpackSENTRY_DSNprocess.env.SENTRY_DSN
esbuildSENTRY_DSNprocess.env.SENTRY_DSN
RollupSENTRY_DSNprocess.env.SENTRY_DSN
Entry Point Setup

Import instrument.ts as the very first import in your entry file:

// src/main.ts or src/index.ts
import "./instrument";  // ← MUST be first

// ... rest of your app
Source Maps Setup (Strongly Recommended)

Without source maps, stack traces show minified code. Set up the build plugin to upload source maps automatically:

No dedicated browser wizard: There is no npx @sentry/wizard -i browser flag. The closest is npx @sentry/wizard@latest -i sourcemaps which configures source map upload only for an already-initialized SDK.

Vite (vite.config.ts):

import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/vite-plugin";

export default defineConfig({
  build: { sourcemap: "hidden" },
  plugins: [
    // sentryVitePlugin MUST be last
    sentryVitePlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});

webpack (webpack.config.js):

const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");

module.exports = {
  devtool: "hidden-source-map",
  plugins: [
    sentryWebpackPlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
};

Rollup (rollup.config.js):

import { sentryRollupPlugin } from "@sentry/rollup-plugin";

export default {
  output: { sourcemap: "hidden" },
  plugins: [
    sentryRollupPlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
};

esbuild (build.js):

const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");

require("esbuild").build({
  entryPoints: ["src/index.ts"],
  bundle: true,
  sourcemap: "hidden",
  plugins: [
    sentryEsbuildPlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});
⚠️ esbuild plugin does not fully support splitting: true. Use sentry-cli instead if code splitting is enabled.

Using sentry-cli (any toolchain / CI):

# After your build step:
npx @sentry/cli sourcemaps inject ./dist
npx @sentry/cli sourcemaps upload ./dist

Add .env for auth (never commit):

SENTRY_AUTH_TOKEN=sntrys_...
SENTRY_ORG=my-org-slug
SENTRY_PROJECT=my-project-slug

Path B: Loader Script (WordPress, Static Sites, Shopify, Squarespace)

Best for: Sites without a build system. The Loader Script is a single <script> tag that lazily loads the full SDK, always stays up to date via Sentry's CDN, and buffers errors before the SDK loads.

Get the Loader Script: Sentry UI → Settings → Projects → (your project) → SDK Setup → Loader Script

Copy the generated tag and place it as the first script on every page:

<!DOCTYPE html>
<html>
  <head>
    <!-- Configure BEFORE the loader tag -->
    <script>
      window.sentryOnLoad = function () {
        Sentry.init({
          // DSN is already configured in the loader URL
          tracesSampleRate: 1.0,
          replaysSessionSampleRate: 0.1,
          replaysOnErrorSampleRate: 1.0,
        });
      };
    </script>

    <!-- Loader Script FIRST — before all other scripts -->
    <script
      src="https://js.sentry-cdn.com/YOUR_PUBLIC_KEY.min.js"
      crossorigin="anonymous"
    ></script>
  </head>
  ...
</html>

Loader loading modes:

ModeHowWhen SDK loads
Lazy (default)Nothing extraOn first error or manual Sentry call
EagerAdd data-lazy="no" to <script>After all page scripts finish
ManualCall Sentry.forceLoad()Whenever you call it

Safe to call before SDK loads (buffered):

  • Sentry.captureException()
  • Sentry.captureMessage()
  • Sentry.captureEvent()
  • Sentry.addBreadcrumb()
  • Sentry.withScope()

For other methods, use Sentry.onLoad():

<script>
  window.Sentry && Sentry.onLoad(function () {
    Sentry.setUser({ id: "123" });
  });
</script>

Set release via global (optional):

<script>
  window.SENTRY_RELEASE = { id: "my-app@1.0.0" };
</script>

Loader Script limitations:

  • ❌ No Sentry.logger.* (logging) — npm path only
  • ❌ No framework-specific features (React ErrorBoundary, Vue Router tracking, etc.)
  • ❌ Tracing headers only added to fetch calls made after SDK loads
  • ❌ Version changes take a few minutes to propagate via CDN cache
  • ⚠️ Use defer (not async) on all other scripts when using the loader

CSP requirements:

script-src: https://browser.sentry-cdn.com https://js.sentry-cdn.com
connect-src: *.sentry.io

Path C: CDN Bundles (Manual Script Tags)

Best for: Pages that can't use the Loader Script but need synchronous loading.

Pick the bundle that matches your feature needs and place it before all other scripts:

Errors only (minimal footprint):

<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.min.js"
  integrity="sha384-L/HYBH2QCeLyXhcZ0hPTxWMnyMJburPJyVoBmRk4OoilqrOWq5kU4PNTLFYrCYPr"
  crossorigin="anonymous"
></script>

Errors + Tracing:

<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.min.js"
  integrity="sha384-DIqcfVcfIewrWiNWfVZcGWExO5v673hkkC5ixJnmAprAfJajpUDEAL35QgkOB5gw"
  crossorigin="anonymous"
></script>

Errors + Session Replay:

<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.replay.min.js"
  integrity="sha384-sbojwIJFpv9duIzsI9FRm87g7pB15s4QwJS1m1xMSOdV1CF3pwgrPPEu38Em7M9+"
  crossorigin="anonymous"
></script>

Errors + Tracing + Replay (recommended full setup):

<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.replay.min.js"
  integrity="sha384-oo2U4zsTxaHSPXJEnXtaQPeS4Z/qbTqoBL9xFgGxvjJHKQjIrB+VRlu97/iXBtzw"
  crossorigin="anonymous"
></script>

Errors + Tracing + Replay + User Feedback:

<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.replay.feedback.min.js"
  integrity="sha384-SmHU39Qs9cua0KLtq3A6gis1/cqM1nZ6fnGzlvWAPiwhBDO5SmwFQV65BBpJnB3n"
  crossorigin="anonymous"
></script>

Full bundle (all features):

<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.replay.feedback.logs.metrics.min.js"
  integrity="sha384-gOjSzRxwpXpy0FlT6lg/AVhagqrsUrOWUO7jm6TJwuZ9YVHtYK0MBA2hW2FGrIGl"
  crossorigin="anonymous"
></script>

CDN bundle variants summary:

BundleFeaturesWhen to use
bundle.min.jsErrors onlyAbsolute minimum footprint
bundle.tracing.min.js+ TracingPerformance monitoring
bundle.replay.min.js+ ReplaySession recording
bundle.tracing.replay.min.js+ Tracing + ReplayFull observability
bundle.tracing.replay.feedback.min.js+ User Feedback+ in-app feedback widget
bundle.logs.metrics.min.js+ Logs + MetricsStructured logs (CDN)
bundle.tracing.replay.feedback.logs.metrics.min.jsEverythingMax coverage

Initialize after the script tag:

<script>
  Sentry.init({
    dsn: "https://YOUR_KEY@o0.ingest.sentry.io/YOUR_PROJECT",
    environment: "production",
    release: "my-app@1.0.0",
    integrations: [
      Sentry.browserTracingIntegration(),
      Sentry.replayIntegration({
        maskAllText: true,
        blockAllMedia: true,
      }),
    ],
    tracesSampleRate: 1.0,
    tracePropagationTargets: ["localhost", /^https:\/\/yourapi\.io/],
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1.0,
  });
</script>

CDN CSP requirements:

script-src: https://browser.sentry-cdn.com https://js.sentry-cdn.com
connect-src: *.sentry.io

For Each Agreed Feature

Walk through features one at a time. Load the reference file, follow its steps, verify before moving on:

FeatureReferenceLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdPage load / API call tracing
Session Replay${SKILL_ROOT}/references/session-replay.mdUser-facing app
Logging${SKILL_ROOT}/references/logging.mdStructured log search; npm or CDN logs bundle (not Loader Script)
Profiling${SKILL_ROOT}/references/profiling.mdPerformance-critical, Chromium-only
User Feedback${SKILL_ROOT}/references/user-feedback.mdCapture user reports after errors

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.


Configuration Reference

Key Sentry.init() Options

OptionTypeDefaultNotes
dsnstring—Required. SDK disabled when empty
environmentstring"production"e.g., "staging", "development"
releasestring—e.g., "my-app@1.0.0" or git SHA — links errors to releases
sendDefaultPiibooleanfalseIncludes IP addresses and request headers
tracesSampleRatenumber—0–1; 1.0 in dev, 0.1–0.2 in prod
tracesSamplerfunction—Per-transaction sampling; overrides rate
tracePropagationTargets`(string\RegExp)[]`same-originOutgoing URLs that receive distributed tracing headers
replaysSessionSampleRatenumber—Fraction of all sessions recorded
replaysOnErrorSampleRatenumber—Fraction of error sessions recorded
enableLogsbooleanfalseEnable Sentry.logger.* API (npm or CDN logs bundle; not Loader Script)
attachStackTracebooleanfalseStack traces on captureMessage() calls
maxBreadcrumbsnumber100Breadcrumbs stored per event
debugbooleanfalseVerbose SDK output to console
tunnelstring—Proxy URL to bypass ad blockers
ignoreErrors`(string\RegExp)[]`[]Drop errors matching these patterns
denyUrls`(string\RegExp)[]`[]Drop errors from scripts at these URLs
allowUrls`(string\RegExp)[]`[]Only capture errors from these script URLs
spotlight`boolean\string`falseForward events to Spotlight local dev overlay

Browser-Specific Options

OptionTypeDefaultNotes
cdnBaseUrlstring—Base URL for lazy-loading integrations
skipBrowserExtensionCheckbooleanfalseSkip check for browser extension context

window.SENTRY_RELEASE Global (CDN / Loader Path)

Set the release version before the SDK loads:

<script>
  window.SENTRY_RELEASE = { id: "my-app@1.0.0" };
</script>

Verification

Trigger test events to confirm Sentry is receiving data:

npm / CDN path:

<!-- Add temporarily to your page -->
<button onclick="throw new Error('Sentry Browser Test Error')">
  Test Error
</button>

Performance verification (npm path):

import * as Sentry from "@sentry/browser";

Sentry.startSpan({ name: "Test Span", op: "test" }, () => {
  // your operation
});

Manual capture:

Sentry.captureException(new Error("Manual test"));
Sentry.captureMessage("Manual test message", "info");

Check the Sentry dashboard:

  • Issues → error appears within seconds
  • Traces → page load transaction visible
  • Replays → session recording visible after page interaction
  • Logs → structured log entries if logging enabled (npm or CDN logs bundle)

Set debug: true in Sentry.init() and check the browser console if nothing appears.


Phase 4: Cross-Link

After completing browser setup, check for a companion backend missing Sentry coverage:

ls ../backend ../server ../api ../go ../python 2>/dev/null
cat ../go.mod 2>/dev/null | head -3
cat ../requirements.txt ../pyproject.toml 2>/dev/null | head -3
cat ../Gemfile 2>/dev/null | head -3
cat ../pom.xml 2>/dev/null | grep '<artifactId>' | head -3
cat ../composer.json 2>/dev/null | head -3

If a backend exists without Sentry configured, suggest the matching skill:

Backend detectedSuggest skill
Go (go.mod)sentry-go-sdk
Python (requirements.txt, pyproject.toml)sentry-python-sdk
Ruby (Gemfile)sentry-ruby-sdk
PHP (composer.json)sentry-php-sdk
.NET (*.csproj, *.sln)sentry-dotnet-sdk
Java (pom.xml, build.gradle)See docs.sentry.io/platforms/java/
Node.js (Express, Fastify)sentry-node-sdk
NestJS (@nestjs/core)sentry-nestjs-sdk

Troubleshooting

IssueSolution
Events not appearingSet debug: true, check DSN, open browser console for SDK errors
Source maps not workingBuild in production mode (npm run build); verify SENTRY_AUTH_TOKEN is set
Minified stack tracesSource maps not uploading — check build plugin config; run npx @sentry/wizard@latest -i sourcemaps
CDN bundle not foundCheck version number in URL; see browser.sentry-cdn.com for latest
SRI integrity errorHash mismatch — re-copy the full <script> tag including integrity attribute from this skill
Loader Script not firingVerify it's the first <script> on the page; check for CSP errors in console
Tracing not working with LoaderFetch calls before SDK loads won't be traced — wrap early calls in Sentry.onLoad()
sentryOnLoad not calledMust define window.sentryOnLoad before the loader <script> tag
Logging not availableSentry.logger.* requires npm or a CDN bundle with .logs. in its name — not supported via Loader Script
Profiling not workingVerify Document-Policy: js-profiling header on document responses; Chromium-only
Ad blockers dropping eventsSet tunnel: "/sentry-tunnel" and add a server-side relay endpoint
Session replay not recordingConfirm replayIntegration() is in init; check replaysSessionSampleRate > 0
Replay CSP errorsAdd worker-src 'self' blob: and child-src 'self' blob: to your CSP
tracePropagationTargets not matchingCheck regex escaping; default is same-origin only
Events blocked by browser extensionAdd denyUrls: [/chrome-extension:\/\//] to filter extension errors
High event volumeLower sampleRate (errors) and tracesSampleRate from 1.0 in production
Source maps uploaded after deploySource maps must be uploaded before errors occur — integrate into CI/CD
esbuild splitting conflictsentryEsbuildPlugin doesn't support splitting: true — use sentry-cli instead

平台分布

Codex

32.83%
按下载量换算2,245

Claude

29.59%
按下载量换算2,024

Cursor

19.18%
按下载量换算1,312

Gemini CLI

9.5%
按下载量换算650

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills