-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add sentry to appkit demo (#3474)
Co-authored-by: tomiir <[email protected]>
- Loading branch information
1 parent
fdc9132
commit 8622237
Showing
8 changed files
with
1,592 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client' | ||
|
||
import * as Sentry from '@sentry/nextjs' | ||
import NextError from 'next/error' | ||
import { useEffect } from 'react' | ||
|
||
export default function GlobalError({ error }: { error: Error & { digest?: string } }) { | ||
useEffect(() => { | ||
Sentry.captureException(error) | ||
}, [error]) | ||
|
||
return ( | ||
<html> | ||
<body> | ||
{/* `NextError` is the default Next.js error page component. Its type | ||
definition requires a `statusCode` prop. However, since the App Router | ||
does not expose status codes for errors, we simply pass 0 to render a | ||
generic error message. */} | ||
<NextError statusCode={0} /> | ||
</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This file configures the initialization of Sentry on the client. | ||
// The config you add here will be used whenever a users loads a page in their browser. | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
||
import * as Sentry from '@sentry/nextjs' | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/4508478682365952', | ||
|
||
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. | ||
tracesSampleRate: 1, | ||
|
||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
|
||
// Only enable Sentry in production | ||
enabled: process.env.NODE_ENV === 'production' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on). | ||
// The config you add here will be used whenever one of the edge features is loaded. | ||
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally. | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
||
import * as Sentry from '@sentry/nextjs' | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/4508478682365952', | ||
|
||
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. | ||
tracesSampleRate: 1, | ||
|
||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
|
||
// Only enable Sentry in production | ||
enabled: process.env.NODE_ENV === 'production' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This file configures the initialization of Sentry on the server. | ||
// The config you add here will be used whenever the server handles a request. | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
||
import * as Sentry from '@sentry/nextjs' | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/4508478682365952', | ||
|
||
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. | ||
tracesSampleRate: 1, | ||
|
||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
|
||
// Only enable Sentry in production | ||
enabled: process.env.NODE_ENV === 'production' | ||
}) |
Oops, something went wrong.