next.js
59c767b2 - Allow `next/headers` in middleware & `draftMode` in edge runtime (#53465)

Commit
2 years ago
Allow `next/headers` in middleware & `draftMode` in edge runtime (#53465) ## What Using methods from `next/headers` in middleware would throw a `requestAsyncStorage` invariant. Additionally, using `draftMode()` in middleware/an edge runtime is not possible ## Why We do not expose `requestAsyncStorage` to the middleware adapter. Also, the prerender manifest wasn't available to the `EdgeRouteModuleWrapper` & middleware adapter, so it wasn't possible to enable/disable it. ## How This makes `requestAsyncStorage` available for middleware, and makes the preview mode data available from build to the edge runtime/middleware. Fixes #52557
Author
Parents
Loading