Skip to content

@astrojs/cloudflare + catch-all prerendered route causes action requests to return HTTP 500 in dev mode #16746

@edmelly

Description

@edmelly

Astro Info

Astro                    v6.3.3
Vite                     v7.3.3
Node                     v24.14.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/cloudflare (v13.5.1)
Integrations             none

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

No response

Describe the Bug

Since Astro 6.3.2, Astro action calls fail with HTTP 500 in Vite dev mode when all three conditions are met:

  • The @astrojs/cloudflare adapter is used with prerenderEnvironment: "node"
  • A catch-all route (e.g. [...page].astro) exists in the project
  • An action (e.g. /_actions/hello) is invoked

The catch-all route's pattern matches any pathname, including action URLs. The new prerender middleware introduced in #16562 uses matchAllRoutes() to decide whether to intercept requests — because the catch-all matches /_actions/hello, the prerender handler intercepts it, finds no static path for it, and falls through to @cloudflare/vite-plugin, which dispatches via miniflare and fails with fetch failed.

What's the expected result?

Action calls return a successful response (e.g. { "message": "Hello, World!" }) in dev mode, consistent with the behaviour after npm run build && npm run preview.

Link to Minimal Reproducible Example

https://github.com/edmelly/astro-cloudflare-action-bug

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)pkg: cloudflareRelated to the Cloudflare adapter

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions