Skip to content

Trailing slash redirects not working #260

@leanderiversen

Description

@leanderiversen

Hi,

I am getting the following error in CloudWatch when accessing a URL without a trailing slash, showing only Internal Server Error on the page. The trailingSlash option is enabled in next.config.js, so I am expecting the URL to be redirected to the trailing slash version.

{
    "errorType": "TypeError",
    "errorMessage": "Expected \"notfile\" to match \"[^\\/#\\?]+?\", but got \"en-gb/test-page\"",
    "stack": [
        "TypeError: Expected \"notfile\" to match \"[^\\/#\\?]+?\", but got \"en-gb/test-page\"",
        "    at file:///var/task/index.mjs:44:200831",
        "    at zm (file:///var/task/index.mjs:54:3634)",
        "    at s9 (file:///var/task/index.mjs:54:3868)",
        "    at uJ (file:///var/task/index.mjs:54:8973)",
        "    at Runtime._J [as handler] (file:///var/task/index.mjs:54:10780)",
        "    at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1147:29)"
    ]
}

The error only appears when using Next.js versions above 13.4.12. Version 2.2.1 of open-next is used, along with 2.28.0 of SST.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions