Skip to content

Commit

Permalink
Fix route validation for Netlify Edge (#4722)
Browse files Browse the repository at this point in the history
* fix: serialize route pattern for Netlify edge

Co-authored-by: Jackie Macharia <jackiewmacharia>

* chore: changeset
  • Loading branch information
bholmesdev authored Sep 12, 2022
1 parent 49006da commit 4bc70f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dull-flowers-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/netlify': patch
---

Fix route validation failures on Netlify Edge
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
}
}
Expand Down

0 comments on commit 4bc70f3

Please sign in to comment.