From 8d3d3806f82bbc3747042e5f00df52a493d10404 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 14 Mar 2024 13:49:55 -0400 Subject: [PATCH] astro: fixes infinite loop during deployment caused by Astro plugins --- examples/astro/sst.config.ts | 4 +--- pkg/platform/src/components/aws/astro.ts | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/astro/sst.config.ts b/examples/astro/sst.config.ts index a7f82cc79..5ea0650d9 100644 --- a/examples/astro/sst.config.ts +++ b/examples/astro/sst.config.ts @@ -5,9 +5,7 @@ export default $config({ return { name: "astro", removal: input?.stage === "production" ? "retain" : "remove", - providers: { - aws: {}, - }, + home: "aws", }; }, async run() { diff --git a/pkg/platform/src/components/aws/astro.ts b/pkg/platform/src/components/aws/astro.ts index 673b53d29..f1e95b408 100644 --- a/pkg/platform/src/components/aws/astro.ts +++ b/pkg/platform/src/components/aws/astro.ts @@ -674,7 +674,11 @@ function buildRouteTree(routes: BuildMetaConfig["routes"], level = 0) { ) { delete routeTree.branches[key]; } else if (branch.nodes.length > 1) { - routeTree.branches[key] = buildRouteTree(branch.nodes, level + 1); + const deduplicatedNodes = branch.nodes.filter( + (node, index, arr) => + arr.findIndex((n) => n.pattern === node.pattern) === index, + ); + routeTree.branches[key] = buildRouteTree(deduplicatedNodes, level + 1); branch.nodes = []; } }