From 2ce1d3821433cd896924dfea7a5284b957634fe9 Mon Sep 17 00:00:00 2001 From: Thomas Chia Date: Mon, 31 Aug 2020 18:53:29 +0800 Subject: [PATCH] Revert some changes which were superseded by @dphang's changes. --- .../lambda-at-edge/src/default-handler.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/libs/lambda-at-edge/src/default-handler.ts b/packages/libs/lambda-at-edge/src/default-handler.ts index 4e6f120bfa..28041f4ce3 100644 --- a/packages/libs/lambda-at-edge/src/default-handler.ts +++ b/packages/libs/lambda-at-edge/src/default-handler.ts @@ -108,12 +108,10 @@ const router = ( manifest: OriginRequestDefaultHandlerManifest ): ((uri: string) => string) => { const { - pages: { ssr, html }, - publicFiles + pages: { ssr, html } } = manifest; const allDynamicRoutes = { ...ssr.dynamic, ...html.dynamic }; - const allNonDynamicRoutes = { ...ssr.nonDynamic, ...html.nonDynamic }; return (uri: string): string => { let normalisedUri = uri; @@ -122,18 +120,15 @@ const router = ( normalisedUri = uri .replace(`/_next/data/${manifest.buildId}`, "") .replace(".json", ""); - } - // Normalise to "/" for index - normalisedUri = ["/index", ""].includes(normalisedUri) - ? "/" - : normalisedUri; - if (allNonDynamicRoutes[normalisedUri]) { - return allNonDynamicRoutes[normalisedUri]; + // Normalise to "/" for index data request + normalisedUri = ["/index", ""].includes(normalisedUri) + ? "/" + : normalisedUri; } - if (publicFiles[normalisedUri]) { - return publicFiles[normalisedUri]; + if (ssr.nonDynamic[normalisedUri]) { + return ssr.nonDynamic[normalisedUri]; } for (const route in allDynamicRoutes) {