1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-16 19:45:33 -04:00

bump next

This commit is contained in:
2022-04-12 20:01:34 -04:00
parent 8641b6a90e
commit 1648464e0e
4 changed files with 191 additions and 171 deletions

View File

@@ -2,20 +2,26 @@ import * as Sentry from "@sentry/node";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import * as Tracing from "@sentry/tracing";
// https://docs.sentry.io/platforms/node/configuration/options/
Sentry.init({
dsn: process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN || "",
environment: process.env.NODE_ENV || process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV || "",
tracesSampleRate: 1.0,
});
const IsomorphicSentry = () => {
// https://docs.sentry.io/platforms/node/configuration/options/
Sentry.init({
dsn: process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN || "",
environment: process.env.NODE_ENV || process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV || "",
tracesSampleRate: 1.0,
});
return Sentry;
};
export const logServerError = async (error: string | Error) => {
try {
const sentryInstance = IsomorphicSentry();
// log error to sentry
Sentry.captureException(error);
sentryInstance.captureException(error);
// give it 2 seconds to finish sending:
// https://docs.sentry.io/platforms/node/configuration/draining/
await Sentry.flush(2000);
await sentryInstance.flush(2000);
} catch (sentryError) {
// cue inception bong
console.error("Encountered an error logging an error... We are doomed.", sentryError);
@@ -28,4 +34,4 @@ export const logServerError = async (error: string | Error) => {
return true;
};
export default Sentry;
export default IsomorphicSentry;