#1436·OpenMAIC

Fix Next.js runtime and deprecation warnings in the console

Author: ztygodCreated Sep 10, 2026Updated Sep 29, 2026
Labelsbuggood first issue

Problem

When running OpenMAIC locally, the console repeatedly reports Next.js runtime compatibility and deprecation warnings.

Although requests still complete successfully, these warnings create unnecessary noise, make real errors harder to identify, and may become build or runtime failures in future Next.js releases.

The following warnings have been identified:

  1. instrumentation.ts uses process.once, which is unsupported in the Edge Runtime.
  2. The project still uses the deprecated middleware.ts file convention instead of proxy.ts.
  3. Other repetitive console output may need review if it provides no diagnostic value.
Image

Root Cause

Node.js APIs in instrumentation

Next.js compiles instrumentation.ts for both the Node.js and Edge runtimes. A runtime check using NEXT_RUNTIME does not prevent the Edge compiler from statically detecting process.once.

Node.js-specific startup and shutdown logic should be isolated in a separate module and dynamically imported only for the Node.js runtime.

Deprecated middleware convention

Next.js 16 has renamed the middleware.ts convention to proxy.ts. The exported middleware function should also be renamed to proxy.

Proposed Changes

  • Move Node.js-specific startup, background-task, and signal-handling logic into a dedicated module.
  • Dynamically import the Node.js instrumentation module only when NEXT_RUNTIME === "nodejs".
  • Rename middleware.ts to proxy.ts.
  • Rename the exported middleware function to proxy.
  • Preserve the existing access-code authentication, workbench feature gates, and route matcher behavior.
  • Remove other redundant console output where appropriate without suppressing actionable errors.

Acceptance Criteria

  • Local development no longer reports process.once is not supported in the Edge Runtime.
  • Local development no longer reports The "middleware" file convention is deprecated.
  • Access-code authentication behavior remains unchanged.
  • Workbench feature-gating behavior remains correct.
  • Unauthorized API requests still return 401.
  • Disabled workbench routes still return 404.
  • Relevant unit tests and lint checks pass.
  • The production build completes without these warnings.
  • Real errors are not hidden, swallowed, or downgraded merely to silence the console.