dashboard: add sentry

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-03-23 21:24:22 +01:00
parent dbf022a430
commit 29527b558c
9 changed files with 403 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
"use client";
import * as Sentry from "@sentry/nextjs";
import Error from "next/error";
import { useEffect } from "react";
export default function GlobalError({ error }) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);
return (
<html>
<body>
<Error />
</body>
</html>
);
}

View File

@@ -6,6 +6,9 @@ export const env = createEnv({
* Specify your server-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars.
*/
shared: {
NEXT_PUBLIC_SENTRY_DSN: z.string().url(),
},
server: {
DATABASE_URL: z
.string()
@@ -35,6 +38,7 @@ export const env = createEnv({
runtimeEnv: {
DATABASE_URL: process.env.DATABASE_URL,
NODE_ENV: process.env.NODE_ENV,
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
},
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially