Skip to content

POST /client/rsc.x-component / Server 404 / Chrome will loop for ever #280

@aheissenberger

Description

@aheissenberger

Describe the bug

Given is the situation, that a request from client for a rsc.x-component is answered with a 404 from the server.
This can happen in a proxied scenario with overlapping routes.

The code currently does not handle any case where !response.ok or !response.body exists.
Chrome shows the 404 error of the resource on the console and than hangs in an endless loop with a spinning loading symbol not reacting to any user input to stop the loading. Only entering the url input and loading an other page sometimes breaks the loop.

This problem does not exist in other browser: Safari, Firefox.

const component = createFromReadableStream(
new ReadableStream({
type: "bytes",
async start(controller) {
let response;
try {
response = await fetch(srcString, {
...options.request,
method: options.method ?? (options.body ? "POST" : "GET"),
body: options.body,
headers: {
...options.request?.headers,
accept: "text/x-component",
...(options.noCache && { "Cache-Control": "no-cache" }),
...(options.prefetch && { "React-Server-Prefetch": "true" }),
...options.headers,
},
credentials: "include",
signal: abortController?.signal,
});
const { body } = response;
window.dispatchEvent(

Reproduction

No response

Steps to reproduce

  1. goto https://d1welhqlw2qcu2.cloudfront.net/client/client in a chrome browser
  2. klick on link with label /client/client (dynamic static overlap) in footer

System Info

System:
    OS: macOS 15.7.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 714.84 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.1.0 - /opt/homebrew/bin/node
    npm: 11.6.2 - /opt/homebrew/bin/npm
    pnpm: 9.15.5 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 141.0.7390.123
    Firefox Developer Edition: 142.0
    Safari: 26.0.1
    Safari Technology Preview: 26.0
  npmPackages:
    @lazarv/react-server: workspace:^ => 0.0.0 
    @lazarv/react-server-adapter-aws-lambda: workspace:^ => 0.0.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions