Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cookies is not iterable" error thrown when trying to iterate over a fetch response that contains a Set-Cookie header #46704

Closed
dtinth opened this issue Feb 17, 2023 · 1 comment · Fixed by #46711
Labels
fetch Issues and PRs related to the Fetch API

Comments

@dtinth
Copy link

dtinth commented Feb 17, 2023

Version

18.14.1

Platform

Darwin dtinth-m1.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64

Subsystem

undici

What steps will reproduce the bug?

See: nodejs/undici#1935

How often does it reproduce? Is there a required condition?

See: nodejs/undici#1935
See: sveltejs/kit#9091

What is the expected behavior?

No error

What do you see instead?

 error   cookies is not iterable
  File:
    /Users/dtinth/Projects/contentsgarten/creatorsgarten/src/pages/api/contentsgarten/[action].ts:82:47
  Code:
    81 |     const response = await fetch(backendUrl, {
    > 82 |       method: request.method,
         |                                               ^
      83 |       headers,
      84 |       body: request.body,
      85 |     })
  Stacktrace:
TypeError: cookies is not iterable
    at get [headers map sorted] (node:internal/deps/undici/undici:1844:34)
    at node:internal/deps/undici/undici:1865:43
    at Headers Iterator.next (node:internal/deps/undici/undici:1108:26)
    at Function.from (<anonymous>)

Additional information

The issue nodejs/undici#1935 is already closed because there was a merged PR that fixes the issue nodejs/undici#1936

However, a Node.js version with the fix has not been released yet… So the issue is shifted to Node.js side to release a version of undici with the fix (or rollback the version of undici that adds the regression).

@mcollina
Copy link
Member

Thanks for reporting. A fix is incoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetch Issues and PRs related to the Fetch API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants