Skip to content

Breaking changes in @astro/netlify between 6.4.0 and 6.5.1 #14087

@softbeehive

Description

@softbeehive

Astro Info

Astro                    v5.11.2
Node                     v22.14.0
System                   macOS (x64)
Package Manager          pnpm
Output                   server
Adapter                  @astrojs/netlify
Integrations             @astrojs/vue
                         @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

What happens

After upgrade to 6.5.0 (also for 6.5.1) all requests to Astro fail due to unhandled exception. I narrowed it down to Netlify Edge Functions. No issue with the edge function code. Even simple set header edge function eventually fails.

error: Uncaught TypeError: Response with null body status cannot have body
    at initializeAResponse (ext:deno_fetch/23_response.js:213:13)
    at new Response (ext:deno_fetch/23_response.js:338:5)
    at Worker.worker.onmessage (file:///Users/user1/projects/project1/node_modules/.pnpm/@netlify+edge-functions@2.15.7/node_modules/@netlify/edge-functions/dist-dev/deno/invoke.mjs:66:22)
    at Worker.wrappedHandler (ext:deno_web/02_event.js:1426:12)
    at innerInvokeEventListeners (ext:deno_web/02_event.js:780:7)
    at invokeEventListeners (ext:deno_web/02_event.js:823:5)
    at dispatch (ext:deno_web/02_event.js:677:9)
    at Worker.dispatchEvent (ext:deno_web/02_event.js:1067:12)
    at Worker.#pollMessages (ext:runtime/11_workers.js:253:12)
    at eventLoopTick (ext:core/01_core.js:178:7)
15:19:07 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace:
TypeError: fetch failed
    at node:internal/deps/undici/undici:13502:13
    at async EdgeFunctionsHandler.getFunctionConfigs (file:///Users/user1/projects/project1/node_modules/.pnpm/@netlify+edge-functions@2.15.7/node_modules/@netlify/edge-functions/dist-dev/node/main.js:85:17)
    at async EdgeFunctionsHandler.match (file:///Users/user1/projects/project1/node_modules/.pnpm/@netlify+edge-functions@2.15.7/node_modules/@netlify/edge-functions/dist-dev/node/main.js:177:32)
    at async NetlifyDev.handleInEphemeralDirectory (file:///Users/user1/projects/project1/node_modules/.pnpm/@netlify+dev@4.4.1_rollup@4.45.1/node_modules/@netlify/dev/dist/main.js:344:31)
    at async NetlifyDev.handleAndIntrospectNodeRequest (file:///Users/user1/projects/project1/node_modules/.pnpm/@netlify+dev@4.4.1_rollup@4.45.1/node_modules/@netlify/dev/dist/main.js:466:14)
    at async netlifyPreMiddleware (file:///Users/user1/projects/project1/node_modules/.pnpm/@netlify+vite-plugin@2.4.1_rollup@4.45.1_vite@6.3.5_@types+node@24.0.14_jiti@2.4.2_lightningcss@1.30.1_yaml@2.8.0_/node_modules/@netlify/vite-plugin/dist/main.js:49:26)
  Hint:
    Make sure your promises all have an `await` or a `.catch()` handler.

How I use Netlify with Astro

I run netlify-cli commands on demand. For example, to serve functions. It forwards requests to netlify servers, though I agree it's a bit cumbersome.

As far as I understand, Astro is trying to improve the DX. But, there are too many moving parts here, it should be at least v7. So folks know it's not a minor version bump.

Reproduction note

Edge functions fail to start due to the issue with fetch. Then Astro skips it and web app still works. My issue occurs when edge functions start. How do I start edge functions in stackblitz? I'm pretty sure it's reproducible.

Temporary solution

Downgrade to v6.4.0

Conclusion

I have an impression you are trying to make netlify adapter way smarter (and complex) it should be in dev mode.

What's the expected result?

Edge Functions work with Astro Netlify adapter

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-ljw82dvt?file=netlify%2Fedge-functions%2Fchange-headers.ts

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions