Skip to content

TypeError: cookies is not iterable #9091

Closed
@Vextil

Description

@Vextil

Describe the bug

After updating kit from 1.5.5 to 1.7.1 I'm getting the following error on every request:

TypeError: cookies is not iterable
    at Headers.get [headers map sorted] (/project/app/node_modules/undici/lib/fetch/headers.js:430:29)
    at /project/app/node_modules/undici/lib/fetch/headers.js:476:21
    at Headers Iterator.next (/project/app/node_modules/undici/lib/fetch/util.js:731:22)
    at Module.serialize_data (/node_modules/@sveltejs/kit/src/runtime/server/page/serialize_data.js:55:24)
    at eval (/node_modules/@sveltejs/kit/src/runtime/server/page/render.js:367:27)
    at Array.map (<anonymous>)
    at Module.render_response (/node_modules/@sveltejs/kit/src/runtime/server/page/render.js:366:5)
    at async Module.render_page (/node_modules/@sveltejs/kit/src/runtime/server/page/index.js:306:10)
    at async resolve (/node_modules/@sveltejs/kit/src/runtime/server/respond.js:371:17)
    at async Module.respond (/node_modules/@sveltejs/kit/src/runtime/server/respond.js:242:20)

Reproduction

Happens when making a server-side fetch to an endpoint that returns a Set-Cookie header.

Seems to be an issue with the new undici version:
nodejs/undici#1935

Fixed here, but no release yet:
nodejs/undici#1936

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 AMD Ryzen 5 5600G with Radeon Graphics
    Memory: 2.42 GB / 5.95 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.17.0 - /usr/local/bin/node
    npm: 8.15.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.3 
    @sveltejs/adapter-cloudflare: ^2.0.1 => 2.0.2 
    @sveltejs/adapter-node: ^1.1.8 => 1.2.0 
    @sveltejs/kit: ^1.7.1 => 1.7.1 
    svelte: ^3.55.0 => 3.55.1 
    vite: ^4.1.0 => 4.1.2

Severity

blocking an upgrade

Additional Information

Probably nothing we can do other than waiting for a new undici version. Rollback not recommended because of security vulnerabilities.
Publishing the issue anyway so if anyone else runs into the same issue they can find this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions