Skip to content

chore: migrate middleware.ts to proxy.ts for Next.js 16#30

Merged
itinsecurity merged 1 commit intomainfrom
chore/nextjs16-compat
Mar 19, 2026
Merged

chore: migrate middleware.ts to proxy.ts for Next.js 16#30
itinsecurity merged 1 commit intomainfrom
chore/nextjs16-compat

Conversation

@itinsecurity
Copy link
Copy Markdown
Owner

Summary

  • Rename src/middleware.tssrc/proxy.ts per Next.js 16 deprecation
  • proxy.ts runs on Node.js runtime (instead of Edge), which is an upgrade for Auth.js — full access to process.env, crypto, and database connections
  • Auth.js v5's auth() wrapper uses Web-standard APIs and works identically on both runtimes

Investigation

A 4-agent team audit verified:

  • force-dynamic exports: Must stay — Auth.js auth() unconditionally calls headers(), forcing dynamic rendering
  • Async APIs: All params, searchParams, auth() already properly awaited
  • Config: next.config.ts, eslint.config.mjs, tsconfig.json all Next.js 16 compliant
  • Breaking changes sweep: Zero deprecated/removed APIs found in codebase

Test plan

  • TypeScript: 0 errors
  • ESLint: 0 errors
  • Unit tests: 101 passing
  • CI passes

🤖 Generated with Claude Code

Next.js 16 deprecates middleware.ts in favor of proxy.ts, which runs on
the Node.js runtime instead of Edge. Auth.js v5's auth() wrapper uses
Web-standard APIs (Request/Response/Headers) and works identically on
both runtimes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@itinsecurity itinsecurity merged commit b008217 into main Mar 19, 2026
9 checks passed
@itinsecurity itinsecurity deleted the chore/nextjs16-compat branch March 19, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant