solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: ERR_HTTP_HEADERS_SENT

Open huseeiin opened this issue 9 months ago • 0 comments

Duplicates

  • [x] I have searched the existing issues

Latest version

  • [x] I have tested the latest version

Current behavior 😯

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

Expected behavior 🤔

no error

Steps to reproduce 🕹

create an api endpoint at src/routes/test.ts:

import type { APIEvent } from "@solidjs/start/server";

export async function GET(event: APIEvent) {
  event.nativeEvent.respondWith(
    Response.json({ message: "Optimistically sent a message!" })
  );

  await fetch("https://jsonplaceholder.typicode.com/todos/1");
}

refresh few times quickly to make sure you get the bug

Context 🔦

No response

Your environment 🌎


huseeiin avatar Mar 17 '25 11:03 huseeiin