Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The patched fetch function should not buffer a streamed response #68447

Merged
merged 5 commits into from
Aug 9, 2024

Conversation

unstubbable
Copy link
Contributor

@unstubbable unstubbable commented Aug 2, 2024

When our patched fetch function comes to the conclusion that it should cache a response, it currently buffers the full response body before returning a pseudo-cloned Response instance.

This is especially a problem in chat applications, where LLM responses need to be streamed to the client immediately, without being buffered.

Since those chat requests are usually POSTs though, the buffering in createPatchedFetcher did not create a problem because this was only applied to GET requests. Although use cases where GET requests are streamed do also exist, most prominently RSC requests. Those would have been already affected by the buffering.

With the introduction of the Server Components HMR cache in #67527 (enabled per default in #67800), the patched fetch function was also buffering POST response bodies, so that they can be stored in the HMR cache. This made the buffering behaviour obvious because now Next.js applications using the AI SDK to stream responses were affected, see vercel/ai#2480 for example.

With this PR, we are now returning the original response immediately, thus allowing streaming again, and cache a cloned response in the background.

As an alternative, I considered to not cache POST requests in the Server Components HMR cache. But I dismissed this solution, because I still think that caching those requests is useful when editing server components. In addition, this solution would not have addressed the buffering issue for GET requests.

Apart from the unit test, I also tested this end-to-end with https://github.com/lgrammel/rsc-streaming-regression.

@ijjk ijjk added created-by: Next.js team PRs by the Next.js team. type: next labels Aug 2, 2024
@ijjk
Copy link
Member

ijjk commented Aug 2, 2024

Tests Passed

@ijjk
Copy link
Member

ijjk commented Aug 2, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
buildDuration 17.5s 15.8s N/A
buildDurationCached 8.7s 7.6s N/A
nodeModulesSize 355 MB 355 MB N/A
nextStartRea..uration (ms) 421ms 436ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
4958.HASH.js gzip 169 B 168 B N/A
6405-HASH.js gzip 5.19 kB 5.19 kB N/A
8711-HASH.js gzip 37.5 kB 37.5 kB N/A
d09468e9-HASH.js gzip 51.9 kB 51.9 kB N/A
framework-HASH.js gzip 56.8 kB 56.7 kB N/A
main-app-HASH.js gzip 224 B 225 B N/A
main-HASH.js gzip 32.5 kB 32.5 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB N/A
Overall change 0 B 0 B
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
_app-HASH.js gzip 194 B 192 B N/A
_error-HASH.js gzip 191 B 192 B N/A
amp-HASH.js gzip 512 B 511 B N/A
css-HASH.js gzip 342 B 344 B N/A
dynamic-HASH.js gzip 1.84 kB 1.84 kB N/A
edge-ssr-HASH.js gzip 265 B 266 B N/A
head-HASH.js gzip 361 B 364 B N/A
hooks-HASH.js gzip 390 B 393 B N/A
image-HASH.js gzip 4.4 kB 4.4 kB N/A
index-HASH.js gzip 268 B 267 B N/A
link-HASH.js gzip 2.82 kB 2.81 kB N/A
routerDirect..HASH.js gzip 328 B 328 B
script-HASH.js gzip 397 B 397 B
withRouter-HASH.js gzip 324 B 324 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 1.16 kB 1.16 kB
Client Build Manifests
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
_buildManifest.js gzip 747 B 749 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
index.html gzip 524 B 521 B N/A
link.html gzip 538 B 537 B N/A
withRouter.html gzip 520 B 518 B N/A
Overall change 0 B 0 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
edge-ssr.js gzip 127 kB 127 kB N/A
page.js gzip 169 kB 168 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
middleware-b..fest.js gzip 671 B 670 B N/A
middleware-r..fest.js gzip 156 B 156 B
middleware.js gzip 29.7 kB 29.7 kB N/A
edge-runtime..pack.js gzip 1.03 kB 1.03 kB
Overall change 1.18 kB 1.18 kB
Next Runtimes
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
928-experime...dev.js gzip 322 B 322 B
928.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 307 kB 307 kB
app-page-exp..prod.js gzip 121 kB 121 kB
app-page-tur..prod.js gzip 133 kB 133 kB
app-page-tur..prod.js gzip 129 kB 129 kB
app-page.run...dev.js gzip 297 kB 297 kB N/A
app-page.run..prod.js gzip 117 kB 117 kB
app-route-ex...dev.js gzip 28 kB 28 kB N/A
app-route-ex..prod.js gzip 18.8 kB 18.8 kB N/A
app-route-tu..prod.js gzip 18.8 kB 18.8 kB N/A
app-route-tu..prod.js gzip 18.6 kB 18.6 kB N/A
app-route.ru...dev.js gzip 29.6 kB 29.7 kB N/A
app-route.ru..prod.js gzip 18.6 kB 18.6 kB N/A
pages-api-tu..prod.js gzip 9.6 kB 9.6 kB
pages-api.ru...dev.js gzip 11.4 kB 11.4 kB
pages-api.ru..prod.js gzip 9.59 kB 9.59 kB
pages-turbo...prod.js gzip 21.6 kB 21.6 kB
pages.runtim...dev.js gzip 27.5 kB 27.5 kB
pages.runtim..prod.js gzip 21.6 kB 21.6 kB
server.runti..prod.js gzip 56.8 kB 56.8 kB
Overall change 966 kB 966 kB
build cache Overall increase ⚠️
vercel/next.js canary vercel/next.js do-not-buffer-cached-responses Change
0.pack gzip 1.42 MB 1.42 MB N/A
index.pack gzip 121 kB 121 kB ⚠️ +191 B
Overall change 121 kB 121 kB ⚠️ +191 B
Diff details
Diff for page.js
@@ -15,7 +15,7 @@
       /***/
     },
 
-    /***/ 9195: /***/ (
+    /***/ 896: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -30,7 +30,7 @@
         default: () => /* binding */ nHandler,
       });
 
-      // NAMESPACE OBJECT: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapp-edge-ssr%2Fpage&page=%2Fapp-edge-ssr%2Fpage&pagePath=private-next-app-dir%2Fapp-edge-ssr%2Fpage.js&appDir=%2Ftmp%2Fnext-statstV78wa%2Fstats-app%2Fapp&appPaths=%2Fapp-edge-ssr%2Fpage&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=&flyingShuttle=false&preferredRegion=&middlewareConfig=e30%3D!./app/app-edge-ssr/page.js?__next_edge_ssr_entry__
+      // NAMESPACE OBJECT: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapp-edge-ssr%2Fpage&page=%2Fapp-edge-ssr%2Fpage&pagePath=private-next-app-dir%2Fapp-edge-ssr%2Fpage.js&appDir=%2Ftmp%2Fnext-statstV78wa%2Fstats-app%2Fapp&appPaths=%2Fapp-edge-ssr%2Fpage&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=&flyingShuttle=false&preferredRegion=&middlewareConfig=e30%3D!./app/app-edge-ssr/page.js?__next_edge_ssr_entry__
       var page_next_edge_ssr_entry_namespaceObject = {};
       __webpack_require__.r(page_next_edge_ssr_entry_namespaceObject);
       __webpack_require__.d(page_next_edge_ssr_entry_namespaceObject, {
@@ -69,35 +69,35 @@
         tree: () => tree,
       });
 
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/web/globals.js
-      var globals = __webpack_require__(1921);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/web/adapter.js + 3 modules
-      var adapter = __webpack_require__(8139);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js + 87 modules
-      var render = __webpack_require__(7567);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/lib/incremental-cache/index.js + 3 modules
-      var incremental_cache = __webpack_require__(5737);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/app-render/app-render.js + 72 modules
-      var app_render = __webpack_require__(7954);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/route-modules/app-page/module.compiled.js
-      var module_compiled = __webpack_require__(7377);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/route-kind.js
-      var route_kind = __webpack_require__(4651);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/client/components/error-boundary.js
-      var error_boundary = __webpack_require__(8775);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/app-render/entry-base.js + 9 modules
-      var entry_base = __webpack_require__(9852); // CONCATENATED MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapp-edge-ssr%2Fpage&page=%2Fapp-edge-ssr%2Fpage&pagePath=private-next-app-dir%2Fapp-edge-ssr%2Fpage.js&appDir=%2Ftmp%2Fnext-statstV78wa%2Fstats-app%2Fapp&appPaths=%2Fapp-edge-ssr%2Fpage&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=&flyingShuttle=false&preferredRegion=&middlewareConfig=e30%3D!./app/app-edge-ssr/page.js?__next_edge_ssr_entry__
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/web/globals.js
+      var globals = __webpack_require__(8037);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/web/adapter.js + 3 modules
+      var adapter = __webpack_require__(3869);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js + 87 modules
+      var render = __webpack_require__(5678);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/lib/incremental-cache/index.js + 3 modules
+      var incremental_cache = __webpack_require__(2989);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/app-render/app-render.js + 72 modules
+      var app_render = __webpack_require__(5977);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/route-modules/app-page/module.compiled.js
+      var module_compiled = __webpack_require__(1077);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/route-kind.js
+      var route_kind = __webpack_require__(3939);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/client/components/error-boundary.js
+      var error_boundary = __webpack_require__(674);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/app-render/entry-base.js + 9 modules
+      var entry_base = __webpack_require__(2234); // CONCATENATED MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapp-edge-ssr%2Fpage&page=%2Fapp-edge-ssr%2Fpage&pagePath=private-next-app-dir%2Fapp-edge-ssr%2Fpage.js&appDir=%2Ftmp%2Fnext-statstV78wa%2Fstats-app%2Fapp&appPaths=%2Fapp-edge-ssr%2Fpage&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=&flyingShuttle=false&preferredRegion=&middlewareConfig=e30%3D!./app/app-edge-ssr/page.js?__next_edge_ssr_entry__
       const component0 = () =>
         Promise.resolve(/* import() eager */).then(
-          __webpack_require__.bind(__webpack_require__, 3876)
+          __webpack_require__.bind(__webpack_require__, 5490)
         );
       const component1 = () =>
         Promise.resolve(/* import() eager */).then(
-          __webpack_require__.bind(__webpack_require__, 7715)
+          __webpack_require__.bind(__webpack_require__, 8383)
         );
       const page2 = () =>
         Promise.resolve(/* import() eager */).then(
-          __webpack_require__.bind(__webpack_require__, 7310)
+          __webpack_require__.bind(__webpack_require__, 3689)
         );
 
       // We inject the tree and pages here so that we can use them in the route
@@ -163,12 +163,12 @@
       });
 
       //# sourceMappingURL=app-page.js.map
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/lib/page-types.js
-      var page_types = __webpack_require__(9467);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/app-render/encryption-utils.js
-      var encryption_utils = __webpack_require__(7850);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/esm/server/app-render/action-utils.js
-      var action_utils = __webpack_require__(6918); // CONCATENATED MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/dist/build/webpack/loaders/next-edge-ssr-loader/index.js?{"absolute500Path":"","absoluteAppPath":"next/dist/pages/_app","absoluteDocumentPath":"next/dist/pages/_document","absoluteErrorPath":"next/dist/pages/_error","absolutePagePath":"private-next-app-dir/app-edge-ssr/page.js","dev":false,"isServerComponent":true,"page":"/app-edge-ssr/page","stringifiedConfig":"eyJlbnYiOnt9LCJlc2xpbnQiOnsiaWdub3JlRHVyaW5nQnVpbGRzIjpmYWxzZX0sInR5cGVzY3JpcHQiOnsiaWdub3JlQnVpbGRFcnJvcnMiOmZhbHNlLCJ0c2NvbmZpZ1BhdGgiOiJ0c2NvbmZpZy5qc29uIn0sImRpc3REaXIiOiIubmV4dCIsImNsZWFuRGlzdERpciI6dHJ1ZSwiYXNzZXRQcmVmaXgiOiIiLCJjYWNoZU1heE1lbW9yeVNpemUiOjUyNDI4ODAwLCJjb25maWdPcmlnaW4iOiJuZXh0LmNvbmZpZy5qcyIsInVzZUZpbGVTeXN0ZW1QdWJsaWNSb3V0ZXMiOnRydWUsImdlbmVyYXRlRXRhZ3MiOnRydWUsInBhZ2VFeHRlbnNpb25zIjpbInRzeCIsInRzIiwianN4IiwianMiXSwicG93ZXJlZEJ5SGVhZGVyIjp0cnVlLCJjb21wcmVzcyI6dHJ1ZSwiaW1hZ2VzIjp7ImRldmljZVNpemVzIjpbNjQwLDc1MCw4MjgsMTA4MCwxMjAwLDE5MjAsMjA0OCwzODQwXSwiaW1hZ2VT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S1zc3IlMkZwYWdlLmpzJmFwcERpcj0lMkZ0bXAlMkZuZXh0LXN0YXRzdFY3OHdhJTJGc3RhdHMtYXBwJTJGYXBwJmFwcFBhdGhzPSUyRmFwcC1lZGdlLXNzciUyRnBhZ2UmcGFnZUV4dGVuc2lvbnM9dHN4JnBhZ2VFeHRlbnNpb25zPXRzJnBhZ2VFeHRlbnNpb25zPWpzeCZwYWdlRXh0ZW5zaW9ucz1qcyZiYXNlUGF0aD0mYXNzZXRQcmVmaXg9Jm5leHRDb25maWdPdXRwdXQ9JmZseWluZ1NodXR0bGU9ZmFsc2UmcHJlZmVycmVkUmVnaW9uPSZtaWRkbGV3YXJlQ29uZmlnPWUzMCUzRCE=","sriEnabled":false,"middlewareConfig":"e30="}!
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/lib/page-types.js
+      var page_types = __webpack_require__(7709);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/app-render/encryption-utils.js
+      var encryption_utils = __webpack_require__(6602);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/esm/server/app-render/action-utils.js
+      var action_utils = __webpack_require__(4137); // CONCATENATED MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/dist/build/webpack/loaders/next-edge-ssr-loader/index.js?{"absolute500Path":"","absoluteAppPath":"next/dist/pages/_app","absoluteDocumentPath":"next/dist/pages/_document","absoluteErrorPath":"next/dist/pages/_error","absolutePagePath":"private-next-app-dir/app-edge-ssr/page.js","dev":false,"isServerComponent":true,"page":"/app-edge-ssr/page","stringifiedConfig":"eyJlbnYiOnt9LCJlc2xpbnQiOnsiaWdub3JlRHVyaW5nQnVpbGRzIjpmYWxzZX0sInR5cGVzY3JpcHQiOnsiaWdub3JlQnVpbGRFcnJvcnMiOmZhbHNlLCJ0c2NvbmZpZ1BhdGgiOiJ0c2NvbmZpZy5qc29uIn0sImRpc3REaXIiOiIubmV4dCIsImNsZWFuRGlzdERpciI6dHJ1ZSwiYXNzZXRQcmVmaXgiOiIiLCJjYWNoZU1heE1lbW9yeVNpemUiOjUyNDI4ODAwLCJjb25maWdPcmlnaW4iOiJuZXh0LmNvbmZpZy5qcyIsInVzZUZpbGVTeXN0ZW1QdWJsaWNSb3V0ZXMiOnRydWUsImdlbmVyYXRlRXRhZ3MiOnRydWUsInBhZ2VFeHRlbnNpb25zIjpbInRzeCIsInRzIiwianN4IiwianMiXSwicG93ZXJlZEJ5SGVhZGVyIjp0cnVlLCJjb21wcmVzcyI6dHJ1ZSwiaW1hZ2VzIjp7ImRldmljZVNpemVzIjpbNjQwLDc1MCw4MjgsMTA4MCwxMjAwLDE5MjAsMjA0OCwzODQwXSwiaW1hZ2VTaXplcyI6WzE2LDMyLDQ4LDY0LDk2LDEyOCwyNTYsMzg0XSwicGF0aCI6Ii9fbmV4dC9pbWFnZSIsImxvYWRlciI6ImRlZmF1bHQiLCJsb2FkZXJGaWxlIjoiIiwiZG9tYWlucyI6W10sImRpc2FibGVTdGF0aWNJbWFnZXMiOmZhbHNlLCJtaW5pbXVtQ2FjaGVUVEwiOjYwLCJmb3JtYXRzIjpbImltYWdlL3dlYnAiXSwiZGFuZ2Vyb3VzbHlBbGxvd1NWRyI6ZmFsc2UsImNvbnRlbnRTZWN1cml0eVBvbGljeSI6InNjcmlwdC1zcmMgJ25vbmUnOyBmcmFtZS1zcmMgJ25vbmUnOyBzYW5k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zMCUzRCE=","sriEnabled":false,"middlewareConfig":"e30="}!
       var _self___RSC_MANIFEST;
 
       const incrementalCacheHandler = null;
@@ -432,50 +432,50 @@
       /***/
     },
 
-    /***/ 1771: /***/ (
+    /***/ 5386: /***/ (
       __unused_webpack_module,
       __unused_webpack_exports,
       __webpack_require__
     ) => {
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 1862)
+        __webpack_require__.bind(__webpack_require__, 8368)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 5625)
+        __webpack_require__.bind(__webpack_require__, 5861)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 9390)
+        __webpack_require__.bind(__webpack_require__, 8878)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 7785)
+        __webpack_require__.bind(__webpack_require__, 2622)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 4618)
+        __webpack_require__.bind(__webpack_require__, 5212)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 3974)
+        __webpack_require__.bind(__webpack_require__, 4381)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 273)
+        __webpack_require__.bind(__webpack_require__, 6577)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 1264)
+        __webpack_require__.bind(__webpack_require__, 6373)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 6945)
+        __webpack_require__.bind(__webpack_require__, 3208)
       );
       Promise.resolve(/* import() eager */).then(
-        __webpack_require__.bind(__webpack_require__, 5257)
+        __webpack_require__.bind(__webpack_require__, 1774)
       );
 
       /***/
     },
 
-    /***/ 6295: /***/ () => {
+    /***/ 4177: /***/ () => {
       /***/
     },
 
-    /***/ 7310: /***/ (
+    /***/ 3689: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -495,7 +495,7 @@
       /***/
     },
 
-    /***/ 3876: /***/ (
+    /***/ 5490: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -507,7 +507,7 @@
         /* harmony export */
       });
       /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ =
-        __webpack_require__(628);
+        __webpack_require__(8150);
 
       function RootLayout({ children }) {
         return /*#__PURE__*/ (0,
@@ -526,7 +526,7 @@
     // webpackRuntimeModules
     /******/ var __webpack_exec__ = (moduleId) =>
       __webpack_require__((__webpack_require__.s = moduleId));
-    /******/ __webpack_require__.O(0, [477, 58], () => __webpack_exec__(9195));
+    /******/ __webpack_require__.O(0, [548, 102], () => __webpack_exec__(896));
     /******/ var __webpack_exports__ = __webpack_require__.O();
     /******/ (_ENTRIES = typeof _ENTRIES === "undefined" ? {} : _ENTRIES)[
       "middleware_app/app-edge-ssr/page"
Diff for middleware.js

Diff too large to display

Diff for edge-ssr.js

Diff too large to display

Diff for image-HASH.js
@@ -1,7 +1,7 @@
 (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
   [8358],
   {
-    /***/ 9842: /***/ (
+    /***/ 5684: /***/ (
       __unused_webpack_module,
       __unused_webpack_exports,
       __webpack_require__
@@ -9,7 +9,7 @@
       (window.__NEXT_P = window.__NEXT_P || []).push([
         "/image",
         function () {
-          return __webpack_require__(8722);
+          return __webpack_require__(2665);
         },
       ]);
       if (false) {
@@ -18,7 +18,7 @@
       /***/
     },
 
-    /***/ 5040: /***/ (module, exports, __webpack_require__) => {
+    /***/ 3608: /***/ (module, exports, __webpack_require__) => {
       "use strict";
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
@@ -40,17 +40,17 @@
         __webpack_require__(2957)
       );
       const _head = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(5187)
+        __webpack_require__(7569)
       );
-      const _getimgprops = __webpack_require__(1332);
-      const _imageconfig = __webpack_require__(3384);
-      const _imageconfigcontextsharedruntime = __webpack_require__(8875);
-      const _warnonce = __webpack_require__(4516);
-      const _routercontextsharedruntime = __webpack_require__(5002);
+      const _getimgprops = __webpack_require__(4429);
+      const _imageconfig = __webpack_require__(2950);
+      const _imageconfigcontextsharedruntime = __webpack_require__(6587);
+      const _warnonce = __webpack_require__(8719);
+      const _routercontextsharedruntime = __webpack_require__(2062);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(5145)
+        __webpack_require__(232)
       );
-      const _usemergedref = __webpack_require__(4926);
+      const _usemergedref = __webpack_require__(9935);
       // This is replaced by webpack define plugin
       const configEnv = {
         deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -371,7 +371,7 @@
       /***/
     },
 
-    /***/ 4926: /***/ (module, exports, __webpack_require__) => {
+    /***/ 9935: /***/ (module, exports, __webpack_require__) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -440,7 +440,7 @@
       /***/
     },
 
-    /***/ 1332: /***/ (
+    /***/ 4429: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -456,9 +456,9 @@
           return getImgProps;
         },
       });
-      const _warnonce = __webpack_require__(4516);
-      const _imageblursvg = __webpack_require__(1569);
-      const _imageconfig = __webpack_require__(3384);
+      const _warnonce = __webpack_require__(8719);
+      const _imageblursvg = __webpack_require__(3207);
+      const _imageconfig = __webpack_require__(2950);
       const VALID_LOADING_VALUES =
         /* unused pure expression or super */ null && [
           "lazy",
@@ -830,7 +830,7 @@
       /***/
     },
 
-    /***/ 1569: /***/ (__unused_webpack_module, exports) => {
+    /***/ 3207: /***/ (__unused_webpack_module, exports) => {
       "use strict";
       /**
        * A shared function, used on both client and server, to generate a SVG blur placeholder.
@@ -885,7 +885,7 @@
       /***/
     },
 
-    /***/ 1674: /***/ (
+    /***/ 3455: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -912,10 +912,10 @@
         },
       });
       const _interop_require_default = __webpack_require__(4345);
-      const _getimgprops = __webpack_require__(1332);
-      const _imagecomponent = __webpack_require__(5040);
+      const _getimgprops = __webpack_require__(4429);
+      const _imagecomponent = __webpack_require__(3608);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(5145)
+        __webpack_require__(232)
       );
       function getImageProps(imgProps) {
         const { props } = (0, _getimgprops.getImgProps)(imgProps, {
@@ -947,7 +947,7 @@
       /***/
     },
 
-    /***/ 5145: /***/ (__unused_webpack_module, exports) => {
+    /***/ 232: /***/ (__unused_webpack_module, exports) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -982,7 +982,7 @@
       /***/
     },
 
-    /***/ 8722: /***/ (
+    /***/ 2665: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -999,8 +999,8 @@
 
       // EXTERNAL MODULE: ./node_modules/.pnpm/react@19.0.0-rc-187dd6a7-20240806/node_modules/react/jsx-runtime.js
       var jsx_runtime = __webpack_require__(8548);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_6tugpsz4gl2xsqrwds5bwcbi3y/node_modules/next/image.js
-      var next_image = __webpack_require__(6629);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-187dd6a7-20240806_re_wxf3je55uhqnotjiz3wkaonabu/node_modules/next/image.js
+      var next_image = __webpack_require__(2856);
       var image_default = /*#__PURE__*/ __webpack_require__.n(next_image); // CONCATENATED MODULE: ./pages/nextjs.png
       /* harmony default export */ const nextjs = {
         src: "/_next/static/media/nextjs.cae0b805.png",
@@ -1030,12 +1030,12 @@
       /***/
     },
 
-    /***/ 6629: /***/ (
+    /***/ 2856: /***/ (
       module,
       __unused_webpack_exports,
       __webpack_require__
     ) => {
-      module.exports = __webpack_require__(1674);
+      module.exports = __webpack_require__(3455);
 
       /***/
     },
@@ -1045,7 +1045,7 @@
     /******/ var __webpack_exec__ = (moduleId) =>
       __webpack_require__((__webpack_require__.s = moduleId));
     /******/ __webpack_require__.O(0, [2888, 9774, 179], () =>
-      __webpack_exec__(9842)
+      __webpack_exec__(5684)
     );
     /******/ var __webpack_exports__ = __webpack_require__.O();
     /******/ _N_E = __webpack_exports__;
Diff for 8711-HASH.js

Diff too large to display

Diff for main-HASH.js

Diff too large to display

Diff for app-route-ex..ntime.dev.js

Diff too large to display

Diff for app-route-ex..time.prod.js

Diff too large to display

Diff for app-route-tu..time.prod.js

Diff too large to display

Diff for app-route-tu..time.prod.js

Diff too large to display

Diff for app-route.runtime.dev.js

Diff too large to display

Diff for app-route.ru..time.prod.js

Diff too large to display

Commit: 90e6fc5

@unstubbable unstubbable force-pushed the do-not-buffer-cached-responses branch from 6a0d4fc to c29de5f Compare August 6, 2024 08:39
@unstubbable unstubbable changed the base branch from canary to no-delete-app-client-cache August 6, 2024 08:39
Copy link
Contributor Author

unstubbable commented Aug 6, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @unstubbable and the rest of your teammates on Graphite Graphite

@unstubbable unstubbable force-pushed the do-not-buffer-cached-responses branch from c29de5f to e6188ec Compare August 6, 2024 08:48
@ijjk ijjk added the tests label Aug 6, 2024
@unstubbable unstubbable changed the base branch from no-delete-app-client-cache to feedthejim/fix-fetch-patch-hmr August 6, 2024 08:48
@unstubbable unstubbable force-pushed the feedthejim/fix-fetch-patch-hmr branch from 2bcc533 to 238ee67 Compare August 6, 2024 11:02
@unstubbable unstubbable force-pushed the do-not-buffer-cached-responses branch from e6188ec to 5deba1b Compare August 6, 2024 11:02
@unstubbable unstubbable force-pushed the feedthejim/fix-fetch-patch-hmr branch from 238ee67 to 326785d Compare August 6, 2024 16:05
@unstubbable unstubbable force-pushed the do-not-buffer-cached-responses branch from 5deba1b to c05acf7 Compare August 6, 2024 16:05
@unstubbable unstubbable marked this pull request as ready for review August 7, 2024 13:06
@unstubbable unstubbable force-pushed the feedthejim/fix-fetch-patch-hmr branch from 326785d to 21717c9 Compare August 9, 2024 09:18
@unstubbable unstubbable force-pushed the do-not-buffer-cached-responses branch from 1375a87 to eab1c9d Compare August 9, 2024 09:19
When our patched `fetch` function comes to the conclusion that it should
cache a response, it currently buffers the full response body before
returning a pseudo-cloned `Response` instance.

This is especially a problem in chat applications, where LLM responses
need to be streamed to the client immediately, without being buffered.

Since those chat requests are usually POSTs though, the buffering in
`createPatchedFetcher` did not create a problem because this was only
applied to GET requests. Although use cases where GET requests are
streamed do also exist, most prominently RSC requests. Those would have
been already affected by the buffering.

With the introduction of the Server Components HMR cache in #67527
(enabled per default in #67800), the patched `fetch` function was also
buffering POST response bodies, so that they can be stored in the HMR
cache. This made the buffering behaviour obvious because now Next.js
applications using the AI SDK to stream responses were affected, see
vercel/ai#2480 for example.

With this PR, we are now returning the original response immediately,
thus allowing streaming again, and cache a cloned response in the
background.

As an alternative, I considered to not cache POST requests in the Server
Components HMR cache. But I dismissed this solution, because I still
think that caching those requests is useful when editing server
components. In addition, this solution would not have addressed the
buffering issue for GET requests.
Avoids confusion with the `let cachedFetchData` in this module.
@unstubbable unstubbable force-pushed the do-not-buffer-cached-responses branch from eab1c9d to 90e6fc5 Compare August 9, 2024 13:56
@unstubbable unstubbable changed the base branch from feedthejim/fix-fetch-patch-hmr to canary August 9, 2024 13:56
@unstubbable unstubbable merged commit 675291c into canary Aug 9, 2024
109 checks passed
@unstubbable unstubbable deleted the do-not-buffer-cached-responses branch August 9, 2024 15:13
unstubbable added a commit that referenced this pull request Aug 12, 2024
…8535)

The first iteration of `deleteAppClientCache()` was introduced in #41510. Its purpose was to remove stale client components (for SSR) from React's cache. Since React didn't (and still doesn't) offer an API for that, this was accomplished by deleting `react-server-dom-webpack` from the require cache.

With the bundling that was introduced in #55362, `deleteAppClientCache()` was changed to delete the whole server runtimes (e.g. `app-page.runtime.dev.js`) from the require cache. This has the unfortunate side effect that also React's other module scope cache (back then `ReactCurrentCache`, now `ReactSharedInternals.A`) is reset between compilations. As a result, when fetching data from a route handler in a page, the fetch cache didn't work properly. This issue was masked though by response buffering for the static generation cache. In #68447 the response buffering will be removed which [uncovered the issue](https://github.com/vercel/next.js/actions/runs/10217197012/job/28270497496).

React had two module-scoped caches for client components:
- `chunkCache` – caches the loaded JS chunks, as specified in the SSR manifest
- `asyncModuleCache` – caches the required modules, if marked as `async` in the SSR manifest

The `asyncModuleCache` was subsequently dropped in facebook/react#26985.

In addition, with Webpack, we don't create any client component chunks for SSR (removed from the manifest in #50959). So there's no need anymore to delete server runtime bundles from the require cache, and we can remove `deleteAppClientCache()` from the `NextJsRequireCacheHotReloader`.

For Turbopack, the exported `deleteAppClientCache` function is still used because Turbopack does create SSR client component chunks. Ideally, React would offer an API to clear the chunk cache. But for now we can keep this logic, since Turbopack also handles this a bit more sophisticated than the Webpack plugin, so that the aforementioned fetch issue does not occur there.

This PR in conjunction with #68193 should then also fix the issue that was reported in #52126.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants