feat: integrate Sentry for error monitoring in Next.js application
- Added Sentry configuration for edge features in `sentry.edge.config.ts` - Added Sentry configuration for server-side in `sentry.server.config.ts` - Created a sample API route to demonstrate error tracking in `src/app/api/sentry-example-api/route.ts` - Developed a frontend page to trigger and log errors in `src/app/sentry-example-page/page.tsx` - Configured client-side Sentry initialization in `src/instrumentation-client.ts` with Replay integration - Implemented instrumentation registration logic in `src/instrumentation.ts`
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
export async function register() {
|
||||
if (process.env.NEXT_RUNTIME === "nodejs") {
|
||||
await import("../sentry.server.config");
|
||||
}
|
||||
|
||||
if (process.env.NEXT_RUNTIME === "edge") {
|
||||
await import("../sentry.edge.config");
|
||||
}
|
||||
}
|
||||
|
||||
export const onRequestError = Sentry.captureRequestError;
|
||||
Reference in New Issue
Block a user