Skip to content

Build Failure for Dynamic File Endpoints in projects with Trailing Slash "always" #17241

Description

@markconnellypro

Astro Info

Astro                    v7.0.4
Vite                     v8.1.0
Node                     v24.1.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

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

N/A

Describe the Bug

Dynamic file endpoints are causing builds to fail with trailingSlash as "always." In 7.0.3, the Minimal Reproducible Example showed 3 static routes generated in the npm run build output; however, for the final 2, it actually created the files without the slash in the dist folder:

  • /api/noname.json
  • /api/foo.json/
  • /api/bar.json/

In 7.0.4, it appears to still be trying to add slashes to the dynamic file endpoints during the build process, and in doing so, is encountering TypeError due to missing parameter.

This does not appear to be affecting non-dynamic file endpoints.

This is likely a bug introduced by #17224

What's the expected result?

The build process should create three files in the Minimal Reproducible Example, which should also be what the npm run build output should show as having been generated:

  • api/bar.json
  • api/foo.json
  • api/noname.json

Link to Minimal Reproducible Example

https://github.com/markconnellypro/astro-trailing-slash/

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)triage: fix verifiedReporter confirmed the triage bot fix works

    Type

    No type

    Fields

    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