From 1e3873c04abab6c498c93abc06828ecd235569d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Alves?= <71379045+andremralves@users.noreply.github.com> Date: Mon, 10 Apr 2023 05:50:54 -0300 Subject: [PATCH] Fix no edge functions deployed to netlify (#6793) --- .changeset/strong-hairs-sort.md | 5 +++++ .../integrations/netlify/src/integration-edge-functions.ts | 3 ++- .../netlify/test/edge-functions/prerender.test.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/strong-hairs-sort.md diff --git a/.changeset/strong-hairs-sort.md b/.changeset/strong-hairs-sort.md new file mode 100644 index 000000000000..518a013e508f --- /dev/null +++ b/.changeset/strong-hairs-sort.md @@ -0,0 +1,5 @@ +--- +'@astrojs/netlify': patch +--- + +fix: no edge functions deployed to netlify diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts index 495501f6806f..b11710430f9d 100644 --- a/packages/integrations/netlify/src/integration-edge-functions.ts +++ b/packages/integrations/netlify/src/integration-edge-functions.ts @@ -122,7 +122,8 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {}) build: { client: outDir, server: new URL('./.netlify/edge-functions/', config.root), - serverEntry: 'entry.mjs', + // Netlify expects .js and will always interpret as ESM + serverEntry: 'entry.js', }, }); }, diff --git a/packages/integrations/netlify/test/edge-functions/prerender.test.ts b/packages/integrations/netlify/test/edge-functions/prerender.test.ts index 976c50b5f000..1a272b101449 100644 --- a/packages/integrations/netlify/test/edge-functions/prerender.test.ts +++ b/packages/integrations/netlify/test/edge-functions/prerender.test.ts @@ -9,7 +9,7 @@ Deno.test({ async fn() { let close = await runBuild('./fixtures/prerender/'); const { default: handler } = await import( - './fixtures/prerender/.netlify/edge-functions/entry.mjs' + './fixtures/prerender/.netlify/edge-functions/entry.js' ); const response = await handler(new Request('http://example.com/index.html')); assertEquals(response, undefined, 'No response because this is an asset');