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

TypeError: Cannot read properties of null (reading 'body') after update from 3.2.4 to 3.2.5 on 302 status code #1574

Closed
PanSzelescik opened this issue Jun 3, 2022 · 6 comments
Labels

Comments

@PanSzelescik
Copy link

Reproduction

Steps to reproduce the behavior:

import fetch from 'node-fetch';

fetch('URL which returns 302 code')
    .then((response) => response.text())
    .then(console.log)
    .catch(console.error);
file:///C:/Git/monitoring_bot/node_modules/node-fetch/src/index.js:113
                        response.body.destroy(error);
                                 ^

TypeError: Cannot read properties of null (reading 'body')
    at file:///C:/Git/monitoring_bot/node_modules/node-fetch/src/index.js:113:13
    at TLSSocket.onSocketClose (file:///C:/Git/monitoring_bot/node_modules/node-fetch/src/index.js:386:5)
    at TLSSocket.emit (node:events:539:35)
    at node:net:715:12
    at TCP.done (node:_tls_wrap:582:7)

Node.js v17.9.0

Expected behavior

Don't throw error, follow redirect and print response.text()

Your Environment

software version
node-fetch 3.2.5
node 17.9.0
npm 8.5.0
Operating System windows and linux

Additional context

Problem exists after update to 3.2.5, on 3.2.4 example code doesn't throw error

@GavinDistaso
Copy link

yep, having the same issue here.

do you know the latest release that doesn't have this issue?

@PanSzelescik
Copy link
Author

3.2.5 version is the same as a92b5d5 and version from GitHub also throws error

@Lucabenj
Copy link

Lucabenj commented Jun 8, 2022

3.2.5 version is the same as a92b5d5 and version from GitHub also throws error

The same

@jimmywarting
Copy link
Collaborator

#1578 was just released, could you try the newest version?

@Lucabenj
Copy link

Just 4 hours of crawling with 2,000 smiultaneous connections and it is ok. It seems as stable as version 3.2.1

@jimmywarting
Copy link
Collaborator

good, closing this then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants