diff --git a/packages/cloudflare/src/cli/build/bundle-server.ts b/packages/cloudflare/src/cli/build/bundle-server.ts index 663c9cd1..68b790ca 100644 --- a/packages/cloudflare/src/cli/build/bundle-server.ts +++ b/packages/cloudflare/src/cli/build/bundle-server.ts @@ -203,7 +203,6 @@ export async function updateWorkerBundledCode( "'require(this.middlewareManifestPath)'", (code) => patches.inlineMiddlewareManifestRequire(code, buildOpts), ], - ["exception bubbling", patches.patchExceptionBubbling], [ "`patchAsyncStorage` call", (code) => diff --git a/packages/cloudflare/src/cli/build/patches/to-investigate/index.ts b/packages/cloudflare/src/cli/build/patches/to-investigate/index.ts index 3050e19d..c3e5da37 100644 --- a/packages/cloudflare/src/cli/build/patches/to-investigate/index.ts +++ b/packages/cloudflare/src/cli/build/patches/to-investigate/index.ts @@ -1,3 +1,2 @@ export * from "./inline-middleware-manifest-require.js"; -export * from "./patch-exception-bubbling.js"; export * from "./patch-read-file.js"; diff --git a/packages/cloudflare/src/cli/build/patches/to-investigate/patch-exception-bubbling.ts b/packages/cloudflare/src/cli/build/patches/to-investigate/patch-exception-bubbling.ts deleted file mode 100644 index 8a1dd0a0..00000000 --- a/packages/cloudflare/src/cli/build/patches/to-investigate/patch-exception-bubbling.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * When using SSG and `dynamicParams = false`, Next.js throws a NoFallbackError. This error is - * bubbled up by default in Node.js servers, however this causes issues in the workerd with - * the current response handling and streaming implementation we have, and leads to hanging - * promises. - */ -export function patchExceptionBubbling(code: string) { - // The code before had: `query._nextBubbleNoFallback = '1'`, that has ben refactored to - // `addRequestMeta(req, 'bubbleNoFallback', true)` in https://github.com/vercel/next.js/pull/74100 - // we need to support both for backward compatibility, that's why we have the following if statement - if (code.includes("_nextBubbleNoFallback")) { - return code.replace('_nextBubbleNoFallback = "1"', "_nextBubbleNoFallback = undefined"); - } - - // The Next.js transpiled code contains something like `(0, _requestmeta.addRequestMeta)(req, "bubbleNoFallback", true);` - // and we want to update it to `(0, _requestmeta.addRequestMeta)(req, "bubbleNoFallback", false);` - return code.replace(/\((.*?.addRequestMeta\)\(.*?,\s+"bubbleNoFallback"),\s+true\)/, "($1, false)"); -}