From 4bc70f3545ab950da306de9c5417a08a7532fa28 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Mon, 12 Sep 2022 19:33:44 -0400 Subject: [PATCH] Fix route validation for Netlify Edge (#4722) * fix: serialize route pattern for Netlify edge Co-authored-by: Jackie Macharia * chore: changeset --- .changeset/dull-flowers-prove.md | 5 +++++ .../integrations/netlify/src/integration-edge-functions.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/dull-flowers-prove.md diff --git a/.changeset/dull-flowers-prove.md b/.changeset/dull-flowers-prove.md new file mode 100644 index 0000000000..8a0e05299a --- /dev/null +++ b/.changeset/dull-flowers-prove.md @@ -0,0 +1,5 @@ +--- +'@astrojs/netlify': patch +--- + +Fix route validation failures on Netlify Edge diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts index 72ab6fb19b..11a18beb9e 100644 --- a/packages/integrations/netlify/src/integration-edge-functions.ts +++ b/packages/integrations/netlify/src/integration-edge-functions.ts @@ -53,7 +53,10 @@ async function createEdgeManifest(routes: RouteData[], entryFile: string, dir: U } else { functions.push({ function: entryFile, - pattern: route.pattern.toString(), + // Make route pattern serializable to match expected + // Netlify Edge validation format. Mirrors Netlify's own edge bundler: + // https://github.com/netlify/edge-bundler/blob/main/src/manifest.ts#L34 + pattern: route.pattern.source.replace(/\\\//g, '/').toString(), }); } }