Skip to content

Error: incorrect header check Z_DATA_ERROR #2603

@jaschaio

Description

@jaschaio

Bug Description

I am trying to fetch a URL but it fails. It works just fine when I use node-fetch, curl or the native browser fetch. It's similar to #1271 but there is no redirect happening.

These are the response headers:

{
  'cache-control': 'no-cache',
  'content-encoding': 'deflate',
  'content-type': 'text/xml; charset=utf-8',
  date: 'Mon, 08 Jan 2024 06:12:38 GMT',
  server: 'lighttpd/1.4.45',
  'transfer-encoding': 'chunked'
}

Reproducible By

const response = await fetch( 'https://egauge90013.egaug.es/cgi-bin/egauge-show?a&E' );

const text = await response.text();

console.log( text );

Expected Behavior

I would expect the response to log into console

Logs

Instead I get this error:

TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11279:53)
    at Fetch.emit (node:events:513:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10534:14)
    at Fetch.fetchParams.controller.resume (node:internal/deps/undici/undici:11258:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: Error: incorrect header check
      at Zlib.zlibOnError [as onerror] (node:zlib:189:17) {
    errno: -3,
    code: 'Z_DATA_ERROR'
  }
}

Environment

Node v20.7.0 and v18.14.2

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