mirror of
https://github.com/getsentry/sentry-for-ai.git
synced 2026-09-14 14:28:22 +08:00
64dfeaa1f1
These per-SDK skills, plus a handful of setup/workflow skills, are superseded by the sentry-instrument skill and the references/sdks/ trees. Move them under skills-legacy/ so they are excluded from the plugin build and skipped by the drift automation, while skills.sentry.dev can still serve them as a fallback for existing URL consumers. Moves 26 skills: the 19 per-SDK skills plus sentry-sdk-skill-creator, sentry-fix-issues, the three sentry-span-streaming-* skills, sentry-instrument-logging, and sentry-instrumentation-guide. Regenerates SKILL_TREE.md and repaths the moved entries in CODEOWNERS. sentry-sdk is intentionally left in place; its removal is handled in a separate PR.
2.7 KiB
2.7 KiB
React Router Framework Features — Sentry React Router Framework SDK
Framework mode package:
@sentry/react-router
Wizard path
Use the installer for fastest setup:
npx @sentry/wizard@latest -i reactRouter
The wizard can:
- install SDK packages
- expose
entry.client.tsxandentry.server.tsx - create
instrument.server.mjs - configure source maps in Vite/React Router config
- add example verification files/routes
Manual framework file checklist
entry.client.tsxwith:Sentry.init(...)HydratedRouter onError={Sentry.sentryOnError}
instrument.server.mjswith serverSentry.init(...)entry.server.tsxwith:createSentryHandleRequestcreateSentryHandleError
- Runtime startup with
NODE_OPTIONS='--import ./instrument.server.mjs'
Source maps for framework builds
Vite plugin
import { reactRouter } from "@react-router/dev/vite";
import { sentryReactRouter } from "@sentry/react-router";
export default defineConfig((config) => ({
plugins: [reactRouter(), sentryReactRouter(sentryConfig, config)],
}));
React Router build end hook
import { sentryOnBuildEnd } from "@sentry/react-router";
export default {
ssr: true,
buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {
await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });
},
};
Auth token
Use SENTRY_AUTH_TOKEN via environment variables (or .env.sentry-build-plugin).
Runtime startup strategies
Preferred (NODE_OPTIONS --import)
{
"scripts": {
"dev": "NODE_OPTIONS='--import ./instrument.server.mjs' react-router dev",
"start": "NODE_OPTIONS='--import ./instrument.server.mjs' react-router-serve ./build/server/index.js"
}
}
Fallback (direct import)
If runtime flags are unavailable, import server instrumentation at the top of entry.server.tsx:
import "./instrument.server.mjs";
This fallback may have incomplete automatic instrumentation compared to --import.
Non-framework handoff
If project uses React Router in data/declarative mode without framework entry wrappers, route setup to sentry-react-sdk (@sentry/react) for v5/v6/v7 integrations.
Troubleshooting
| Issue | Solution |
|---|---|
| Entry files not present | Run npx react-router reveal |
| Source maps still minified | Confirm both sentryReactRouter plugin and sentryOnBuildEnd hook are configured |
| Server startup misses instrumentation | Ensure NODE_OPTIONS --import is actually applied in deployed runtime |
| Framework setup used in non-framework app | Switch to sentry-react-sdk guidance |