From efb6602ac557765e11fdb99b19e7ac497206b80e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 29 May 2026 22:40:10 +0000 Subject: [PATCH] Fix dev CI build failures --- apps/dashboard/src/instrumentation-node.ts | 12 ++++ apps/dashboard/src/instrumentation.ts | 68 ++++++++----------- .../template/src/providers/stack-context.tsx | 2 +- .../providers/translation-provider-client.tsx | 2 +- 4 files changed, 44 insertions(+), 40 deletions(-) create mode 100644 apps/dashboard/src/instrumentation-node.ts diff --git a/apps/dashboard/src/instrumentation-node.ts b/apps/dashboard/src/instrumentation-node.ts new file mode 100644 index 000000000..54e502d72 --- /dev/null +++ b/apps/dashboard/src/instrumentation-node.ts @@ -0,0 +1,12 @@ +import "server-only"; + +import { getEnvVariable } from "@hexclave/shared/dist/utils/env"; + +export async function startRemoteDevelopmentEnvironmentLifecycleIfNeeded(): Promise { + if (getEnvVariable("NEXT_PUBLIC_STACK_IS_REMOTE_DEVELOPMENT_ENVIRONMENT", "") !== "true") { + return; + } + + const { startRemoteDevelopmentEnvironmentLifecycle } = await import("./lib/remote-development-environment/manager"); + startRemoteDevelopmentEnvironmentLifecycle(); +} diff --git a/apps/dashboard/src/instrumentation.ts b/apps/dashboard/src/instrumentation.ts index b23fad834..599b21498 100644 --- a/apps/dashboard/src/instrumentation.ts +++ b/apps/dashboard/src/instrumentation.ts @@ -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 { - if (getNextRuntime() !== "nodejs" || getEnvVariable("NEXT_PUBLIC_STACK_IS_REMOTE_DEVELOPMENT_ENVIRONMENT", "") !== "true") { +export async function register(): Promise { + 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; + }, + }); } diff --git a/packages/template/src/providers/stack-context.tsx b/packages/template/src/providers/stack-context.tsx index 289da0fd2..4e1fed420 100644 --- a/packages/template/src/providers/stack-context.tsx +++ b/packages/template/src/providers/stack-context.tsx @@ -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 = { diff --git a/packages/template/src/providers/translation-provider-client.tsx b/packages/template/src/providers/translation-provider-client.tsx index 693b6f570..e6593772c 100644 --- a/packages/template/src/providers/translation-provider-client.tsx +++ b/packages/template/src/providers/translation-provider-client.tsx @@ -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,