mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
waitUntil Sentry flush is complete
This commit is contained in:
parent
560ee4c16e
commit
82c923e03c
@ -2,6 +2,7 @@ import * as Sentry from "@sentry/nextjs";
|
||||
import { getEnvVariable, getNodeEnvironment } from "@stackframe/stack-shared/dist/utils/env";
|
||||
import { captureError, registerErrorSink } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
import * as util from "util";
|
||||
import { runAsynchronouslyAndWaitUntil } from "./utils/background-tasks";
|
||||
|
||||
function expandStackPortPrefix(value?: string | null) {
|
||||
if (!value) return value ?? undefined;
|
||||
@ -11,10 +12,12 @@ function expandStackPortPrefix(value?: string | null) {
|
||||
|
||||
const sentryErrorSink = (location: string, error: unknown) => {
|
||||
if (!("captureException" in Sentry)) {
|
||||
// this happens if somehow this is called outside of a Next.js script (eg. in the Prisma seed.ts), just ignore
|
||||
// this happens if somehow this is called outside of a Next.js script (eg. in the Prisma seed.ts), just log and ignore
|
||||
console.log("Attempted to capture Sentry error outside of Next.js script, ignoring");
|
||||
return;
|
||||
}
|
||||
Sentry.captureException(error, { extra: { location } });
|
||||
runAsynchronouslyAndWaitUntil(Sentry.flush());
|
||||
};
|
||||
|
||||
export function ensurePolyfilled() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user