7dde951306
- 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`
18 lines
484 B
TypeScript
18 lines
484 B
TypeScript
import * as Sentry from "@sentry/nextjs";
|
|
export const dynamic = "force-dynamic";
|
|
|
|
class SentryExampleAPIError extends Error {
|
|
constructor(message: string | undefined) {
|
|
super(message);
|
|
this.name = "SentryExampleAPIError";
|
|
}
|
|
}
|
|
|
|
// A faulty API route to test Sentry's error monitoring
|
|
export function GET() {
|
|
Sentry.logger.info("Sentry example API called");
|
|
throw new SentryExampleAPIError(
|
|
"This error is raised on the backend called by the example page.",
|
|
);
|
|
}
|