Skip to content

Premature close #1219

@weijarz

Description

@weijarz
import fetch from 'node-fetch'

const response = await fetch('https://fex.baidu.com/feed.xml')
const body = await response.text()

console.log(body)

Throws

file:///home/wjzhou/tmp/tmp/fetchbug/node_modules/node-fetch/src/body.js:210
		const error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, 'system', error);
		                                                         ^

FetchError: Invalid response body while trying to fetch https://fex.baidu.com/feed.xml: Premature close
    at consumeBody (file:///home/wjzhou/tmp/tmp/fetchbug/node_modules/node-fetch/src/body.js:210:60)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Response.text (file:///home/wjzhou/tmp/tmp/fetchbug/node_modules/node-fetch/src/body.js:129:18)
    at async file:///home/wjzhou/tmp/tmp/fetchbug/b.js:4:14 {
  type: 'system',
  errno: 'ERR_STREAM_PREMATURE_CLOSE',
  code: 'ERR_STREAM_PREMATURE_CLOSE',
  erroredSysCall: undefined
}
software version
node-fetch 3.0.0-beta.10
node v14.16.0
npm 7.17.0
Operating System archlinux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions