diff --git a/Dockerfile b/Dockerfile index cc36e7fd6a..96bcb73e76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,10 @@ COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/.next/standalone ./ # Explicitly copy @swc/helpers — not always traced by standalone output but needed at runtime COPY --from=builder /app/node_modules/@swc/helpers ./node_modules/@swc/helpers +# Explicitly copy pino transport dependencies — pino spawns a worker that requires +# pino-abstract-transport at runtime; Next.js standalone trace does not capture it (#449) +COPY --from=builder /app/node_modules/pino-abstract-transport ./node_modules/pino-abstract-transport +COPY --from=builder /app/node_modules/pino-pretty ./node_modules/pino-pretty COPY --from=builder /app/scripts/run-standalone.mjs ./run-standalone.mjs COPY --from=builder /app/scripts/runtime-env.mjs ./runtime-env.mjs COPY --from=builder /app/scripts/bootstrap-env.mjs ./bootstrap-env.mjs diff --git a/package-lock.json b/package-lock.json index c0482c2ad1..3535e36063 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "omniroute", - "version": "2.7.0", + "version": "2.7.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "omniroute", - "version": "2.7.0", + "version": "2.7.2", "hasInstallScript": true, "license": "MIT", "workspaces": [ diff --git a/src/app/api/v1/responses/route.ts b/src/app/api/v1/responses/route.ts index 2588bc900f..809ed1a41f 100644 --- a/src/app/api/v1/responses/route.ts +++ b/src/app/api/v1/responses/route.ts @@ -1,16 +1,14 @@ import { CORS_ORIGIN } from "@/shared/utils/cors"; import { handleChat } from "@/sse/handlers/chat"; -import { initTranslators } from "@omniroute/open-sse/translator/index.ts"; -let initialized = false; - -async function ensureInitialized() { - if (!initialized) { - await initTranslators(); - initialized = true; - console.log("[SSE] Translators initialized for /v1/responses"); - } -} +// NOTE: We do NOT call initTranslators() here — the translator registry is +// bootstrapped at module level inside open-sse/translator/index.ts when it +// is first imported. Calling it again from a Next.js Route Handler caused a +// "the worker has exited" uncaughtException crash on Codex CLI requests (#450) +// because the dynamic import runs in a Next.js server worker context where +// certain Node APIs used by the translator bootstrap are not available. +// The translators are always initialized via the open-sse side (chatCore), +// so /v1/responses just delegates to handleChat which handles everything. export async function OPTIONS() { return new Response(null, { @@ -24,9 +22,8 @@ export async function OPTIONS() { /** * POST /v1/responses - OpenAI Responses API format - * Now handled by translator pattern (openai-responses format auto-detected) + * Handled by the unified chat handler (openai-responses format auto-detected). */ export async function POST(request) { - await ensureInitialized(); return await handleChat(request); }