mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix dev CI build failures
This commit is contained in:
parent
609579abab
commit
efb6602ac5
12
apps/dashboard/src/instrumentation-node.ts
Normal file
12
apps/dashboard/src/instrumentation-node.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import "server-only";
|
||||
|
||||
import { getEnvVariable } from "@hexclave/shared/dist/utils/env";
|
||||
|
||||
export async function startRemoteDevelopmentEnvironmentLifecycleIfNeeded(): Promise<void> {
|
||||
if (getEnvVariable("NEXT_PUBLIC_STACK_IS_REMOTE_DEVELOPMENT_ENVIRONMENT", "") !== "true") {
|
||||
return;
|
||||
}
|
||||
|
||||
const { startRemoteDevelopmentEnvironmentLifecycle } = await import("./lib/remote-development-environment/manager");
|
||||
startRemoteDevelopmentEnvironmentLifecycle();
|
||||
}
|
||||
@ -1,58 +1,50 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
import { getEnvBoolean, getEnvVariable, getNextRuntime, getNodeEnvironment } from "@hexclave/shared/dist/utils/env";
|
||||
import { getEnvBoolean, getEnvVariable, getNodeEnvironment } from "@hexclave/shared/dist/utils/env";
|
||||
import { sentryBaseConfig } from "@hexclave/shared/dist/utils/sentry";
|
||||
import { nicify } from "@hexclave/shared/dist/utils/strings";
|
||||
import "./polyfills";
|
||||
|
||||
async function startRemoteDevelopmentEnvironmentLifecycleIfNeeded(): Promise<void> {
|
||||
if (getNextRuntime() !== "nodejs" || getEnvVariable("NEXT_PUBLIC_STACK_IS_REMOTE_DEVELOPMENT_ENVIRONMENT", "") !== "true") {
|
||||
export async function register(): Promise<void> {
|
||||
if (process.env.NEXT_RUNTIME !== "nodejs" && process.env.NEXT_RUNTIME !== "edge") {
|
||||
return;
|
||||
}
|
||||
|
||||
const { startRemoteDevelopmentEnvironmentLifecycle } = await import("./lib/remote-development-environment/manager");
|
||||
startRemoteDevelopmentEnvironmentLifecycle();
|
||||
}
|
||||
|
||||
export async function register() {
|
||||
if (getNextRuntime() === "nodejs") {
|
||||
if (process.env.NEXT_RUNTIME === "nodejs") {
|
||||
if (getEnvBoolean("NEXT_PUBLIC_STACK_IS_REMOTE_DEVELOPMENT_ENVIRONMENT")) {
|
||||
globalThis.process.title = `Hexclave — Development Server (port ${getEnvVariable("PORT", "?")})`;
|
||||
} else {
|
||||
globalThis.process.title = `stack-dashboard:${getEnvVariable("NEXT_PUBLIC_HEXCLAVE_PORT_PREFIX", "81")} (node/nextjs)`;
|
||||
}
|
||||
const { startRemoteDevelopmentEnvironmentLifecycleIfNeeded } = await import("./instrumentation-node");
|
||||
await startRemoteDevelopmentEnvironmentLifecycleIfNeeded();
|
||||
}
|
||||
|
||||
if (getNextRuntime() === "nodejs" || getNextRuntime() === "edge") {
|
||||
Sentry.init({
|
||||
...sentryBaseConfig,
|
||||
Sentry.init({
|
||||
...sentryBaseConfig,
|
||||
|
||||
dsn: getEnvVariable("NEXT_PUBLIC_SENTRY_DSN", ""),
|
||||
dsn: getEnvVariable("NEXT_PUBLIC_SENTRY_DSN", ""),
|
||||
|
||||
enabled: getNodeEnvironment() !== "development" && !getEnvVariable("CI", ""),
|
||||
enabled: getNodeEnvironment() !== "development" && !getEnvVariable("CI", ""),
|
||||
|
||||
// Add exception metadata to the event
|
||||
beforeSend(event, hint) {
|
||||
const error = hint.originalException;
|
||||
let nicified;
|
||||
try {
|
||||
nicified = nicify(error, { maxDepth: 8 });
|
||||
} catch (e) {
|
||||
nicified = `Error occurred during nicification: ${e}`;
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
event.extra = {
|
||||
...event.extra,
|
||||
cause: error.cause,
|
||||
errorProps: {
|
||||
...error,
|
||||
},
|
||||
nicifiedError: nicified,
|
||||
};
|
||||
}
|
||||
return event;
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
beforeSend(event, hint) {
|
||||
const error = hint.originalException;
|
||||
let nicified;
|
||||
try {
|
||||
nicified = nicify(error, { maxDepth: 8 });
|
||||
} catch (e) {
|
||||
nicified = `Error occurred during nicification: ${e}`;
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
event.extra = {
|
||||
...event.extra,
|
||||
cause: error.cause,
|
||||
errorProps: {
|
||||
...error,
|
||||
},
|
||||
nicifiedError: nicified,
|
||||
};
|
||||
}
|
||||
return event;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { createGlobal } from "@stackframe/stack-shared/dist/utils/globals";
|
||||
import { createGlobal } from "@hexclave/shared/dist/utils/globals";
|
||||
import type { StackClientApp } from "../lib/stack-app/apps/interfaces/client-app";
|
||||
|
||||
type StackContextValue = {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { createGlobal } from "@stackframe/stack-shared/dist/utils/globals";
|
||||
import { createGlobal } from "@hexclave/shared/dist/utils/globals";
|
||||
|
||||
type TranslationContextValue = {
|
||||
quetzalKeys: Map<string, string>,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user