Skip to content

Static export with a specified basePath causes request mismatch for RSC payload .txt file #73427

Description

@yukiyokotani

Link to the code that reproduces this issue

https://github.com/yukiyokotani/next-static-export-404-reproduce

To Reproduce

  1. The code in the linked repository is deployed in the following github pages with static export.
  2. This site only has a link to the root path: /. If you look at the network tab in the developer tools, you will see that the RSC Payload request corresponding to the root path is 404.

Current vs. Expected behavior

Current:

Expected:

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.2.0
  npm: 10.8.1
  Yarn: 3.2.4
  pnpm: 9.4.0
Relevant Packages:
  next: 14.2.18 // An outdated version detected (latest is 15.0.3), upgrade is highly recommended!
  eslint-config-next: 14.2.18
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.7.2
Next.js Config:
  output: export

Which area(s) are affected? (Select all that apply)

Output (export/standalone)

Which stage(s) are affected? (Select all that apply)

next build (local), Other (Deployed)

Additional context

In the code output generated by Static Export, the request path for the RSC Payload .txt files is constructed by appending .txt to the page path if the path ends with '/', and by appending index.txt otherwise. When basePath is set and trailingSlash is disabled (default settings), the root path '/' is treated as '', and according to the mentioned logic, the RSC Payload .txt file path becomes {basePath}.txt. However, the RSC Payload .txt file corresponding to '/' in the Static Export output is always index.txt. As a result, when trying to access {basePath}.txt, which should be {basePath}/index.txt, a 404 error occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OutputRelated to the the output configuration option.bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions