Skip to content

Commit

Permalink
temp-fix: rendering error in next.js 14.0.2 caused by next.js bug (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-elicx authored Nov 11, 2023
1 parent bf57ec9 commit c83d125
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-spoons-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/next-on-pages': patch
---

Temporary hotfix for `vercel/next.js#58265` so that rendering in Next.js >= 14.0.2 works.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,14 @@ function fixFunctionContents(contents: string): string {
'$1',
);

// TODO: Remove once https://github.com/vercel/next.js/issues/58265 is fixed.
// This resolves a critical issue in Next.js 14.0.2 that breaks edge runtime rendering due to the assumption
// that the the passed internal request is of type `NodeNextRequest` and never `WebNextRequest`.
contents = contents.replace(
/;let{originalRequest:(\w+)}=(\w+);/gm,
';let{originalRequest:$1=$2}=$2;',
);

return contents;
}

Expand Down

0 comments on commit c83d125

Please sign in to comment.