kit icon indicating copy to clipboard operation
kit copied to clipboard

Internal Error: immutable for sveltekit fetch

Open JLewinski opened this issue 6 months ago • 0 comments

Describe the bug

Using the sveltekit fetch in a +page.server.ts load function will cause an Internal Error whenever a cookie is set in the hooks.server.ts handle function.

Reproduction

  1. Create an api server and add public endpoints to it
  2. Setup a Sveltekit application with a vite proxy to point a specific route to the api server
  3. Add a +page.server.ts file and use event.fetch to attempt to access the api via the proxy
  4. Add a hooks.server.ts file and add a cookie to the event
  5. Run both the api and sveltekit applications
  6. Notice when the page is hit it will return an Internal Error

Here is a working reproduction: https://github.com/JLewinski/Reproduction/tree/master

Logs


System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics
    Memory: 33.68 GB / 59.67 GB
  Binaries:
    Node: 18.20.8 - C:\nvm4w\nodejs\node.EXE
    npm: 10.8.2 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (133.0.3065.92)

Severity

annoyance

Additional Information

At the very least it would be good to have a better error message, so developers understand what is going on.

JLewinski avatar Jun 04 '25 18:06 JLewinski