ConusAI vendor v0.1.0-dev.20261027+9b1131fb
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-dev.20261027+9b1131fb
2026-10-27 18:05:17 +00:00
commit 3102273ec7
538 changed files with 80203 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
// Next.js runs `register` once when a server instance starts, before it takes a request, and
// `onRequestError` for every error a render, a route or an action leaves unhandled (spec §9.5).
//
// `register` parses the deployment contract and nothing else: a missing or forbidden platform
// variable stops the server here, with a typed error that names it, before the first request. It
// builds nothing. Next.js bundles this file apart from the routes, and a registry or an error client
// built in this bundle would be a second copy of every contract the routes then fail to match
// ("procedure ... is not registered with this contract"); the runtime, observability included, is
// built on the first request by the routes' own copy (src/server/app.ts), and shared with this file only as
// the observability handle, which holds no kit module (config/src/observability.ts).
import type { Instrumentation } from "next"
export async function register(): Promise<void> {
if (process.env.NEXT_RUNTIME !== "nodejs") return
const { loadAppEnv } = await import("@app/config")
loadAppEnv("web")
}
export const onRequestError: Instrumentation.onRequestError = async (error, request, context) => {
if (process.env.NEXT_RUNTIME !== "nodejs") return
const [{ currentObservability }, { reportRequestError }] = await Promise.all([
import("@app/config"),
import("./src/server/report"),
])
// Nothing has been started when no request has reached the routes yet; there is nothing to report through.
const observe = currentObservability()
if (observe) reportRequestError(observe, error, request, context)
}