Skip to content

[Bug]: [v2] HttpStatusCode with deferStream no longer works #2229

Description

@katywings

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Setting the response status code with <HttpStatusCode code={404} /> after waiting for some query data with deferStream: true, stopped working with Start v2. It instead just responds with 200. The same regression probably applies to <HttpHeader>.

Expected behavior 🤔

The response status code should be properly sended, even if <HttpStatusCode code={404} /> is server-rendered late with deferStream: true.

Steps to reproduce 🕹

  1. Set the following as content of src/routes/[...404].tsx:
import { Title } from "@solidjs/meta";
import { createAsync, query } from "@solidjs/router";
import { HttpStatusCode } from "@solidjs/start";
import { Show } from "solid-js";

const getData = query(async () => "test", "data");

export default function NotFound() {
  const data = createAsync(() => getData(), { deferStream: true });

  return (
    <main>
      {data()}
      <Title>Not Found</Title>
      <Show when={data()}>
        <HttpStatusCode code={404} />
      </Show>
      
      <h1>Page Not Found</h1>
      <p>
        Visit{" "}
        <a href="https://start.solidjs.com" target="_blank">
          start.solidjs.com
        </a>{" "}
        to learn how to build SolidStart apps.
      </p>
    </main>
  );
}
  1. Open http://localhost:3000/notfound
  2. Check the status code

Context 🔦

No response

Your environment 🌎

- node: v24.18
- Start: ^2.0.0-rc.1

Metadata

Metadata

Assignees

Labels

2.xtargeting SolidStart 2.x versionsbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions