From d1dce9eec60e5265ab45eb3343bc866f1e2da5ea Mon Sep 17 00:00:00 2001 From: Benjamin Manns Date: Sun, 8 Sep 2024 12:14:51 -0400 Subject: [PATCH] Fix prerendered dynamic ISR functions with catch-all segments (#864) --- .changeset/odd-lemons-jog.md | 5 +++++ .../processVercelFunctions/invalidFunctions.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/odd-lemons-jog.md diff --git a/.changeset/odd-lemons-jog.md b/.changeset/odd-lemons-jog.md new file mode 100644 index 000000000..f78168778 --- /dev/null +++ b/.changeset/odd-lemons-jog.md @@ -0,0 +1,5 @@ +--- +'@cloudflare/next-on-pages': patch +--- + +Fix prerendered dynamic ISR functions with catch-all segments diff --git a/packages/next-on-pages/src/buildApplication/processVercelFunctions/invalidFunctions.ts b/packages/next-on-pages/src/buildApplication/processVercelFunctions/invalidFunctions.ts index d6d92d729..00872adaa 100644 --- a/packages/next-on-pages/src/buildApplication/processVercelFunctions/invalidFunctions.ts +++ b/packages/next-on-pages/src/buildApplication/processVercelFunctions/invalidFunctions.ts @@ -339,7 +339,7 @@ async function tryToFixInvalidDynamicISRFuncs({ const isDynamicISRFunc = fnInfo.config.operationType === 'ISR' && - /\/\[[\w-]+\]$/.test(fnPathWithoutRscOrFuncExt); + /\/\[(?:\.\.\.)?[\w-]+\]$/.test(fnPathWithoutRscOrFuncExt); if (isDynamicISRFunc) { const matchingPrerenderedChildFunc = prerenderedFunctionEntries.find(