Skip to content

TypeError: fetch failed #1271

@minas90

Description

@minas90

Bug Description

Fetch fails with some URLs (after redirect?).

Reproducible By

let res = await fetch('https://www.luzernerzeitung.ch/kultur/literatur-im-pool-ld.2260742');

Expected Behavior

It should get the URL without any exception. The same code works just fine with 'node-fetch'.

Logs & Screenshots

    at Object.processResponse (node:internal/deps/undici/undici:7081:34)
    at Fetch.fetchFinale (node:internal/deps/undici/undici:7411:21)
    at Fetch.mainFetch (node:internal/deps/undici/undici:7305:21)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  cause: Error: incorrect header check
      at Zlib.zlibOnError [as onerror] (node:zlib:189:17) {
    errno: -3,
    code: 'Z_DATA_ERROR'
  }
}

Environment

macOS 11.6.4, Node v17.6.0

Additional context

The provided URL redirects and adds ?reduced=true at the end of the URL:
https://www.luzernerzeitung.ch/kultur/literatur-im-pool-ld.2260742?reduced=true
When I run the same code with this redirected URL, it works fine.

I guess a little tweak with the gzip code or redirect logic should fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions