Commit Graph

3 Commits

Author SHA1 Message Date
JJ Kasper 69d63edcc7 Fix missing incremental cache in middleware unstable_cache (#89980)
## Summary
- pass `IncrementalCache` into the shared middleware template adapter so
middleware/proxy modules initialize `globalThis.__incrementalCache`
- add regression coverage for `unstable_cache` usage inside both
deprecated `middleware` (edge) and `proxy` (node) fixtures
- verify both e2e suites pass without hitting `Invariant:
incrementalCache missing in unstable_cache`

## Verification
- `pnpm build`
- `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testonly
test/e2e/app-dir/app-middleware/app-middleware.test.ts`
- `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testonly
test/e2e/app-dir/app-middleware-proxy/app-middleware-proxy.test.ts`
2026-02-13 14:22:32 -08:00
Niklas Mischkulnig 074262baf3 Only allow node runtime in proxy (#85139)
This PR is the initiative of deprecating the edge runtime. Proxy will
default to Node.js runtime, and will not allow runtime config. If the
users want to use the edge runtime, they should stay on the Middleware,
though we recommend starting the migration.

---------

Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-10-21 16:06:11 -07:00
Jiwon Choi d7a58203d1 Deprecate middleware and recommend proxy (#84119)
We recommend users avoid relying on Middleware unless no other options
exist. Our goal is to give them APIs with better ergonomics so they can
achieve their goals without Middleware.

The term “middleware” often confuses users with Express.js middleware,
which can encourage misuse. To clarify our direction, we are renaming
the file convention to “proxy.” This highlights that we are moving away
from Middleware, breaking down its overloaded features, and making the
Proxy clear in its purpose.

`proxy.js` should be a drop-in replacement for `middleware.js` for its
features, but ONE thing:

```diff
- export function middleware
+ export function proxy
```

Codemod: https://github.com/vercel/next.js/pull/84127

---------

Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
2025-10-09 04:00:53 +02:00