TypeError: Cannot read properties of null (reading 'body') after update from 3.2.4 to 3.2.5 on 302 status code
See original GitHub issueReproduction
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
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6
Top Results From Across the Web
TypeError: Cannot read properties of null (reading 'user')
The error clearly say what's going wrong. It is because your initial value of user is null . That's why when you do...
Read more >cannot read properties of null (reading 'body') - You.com
node-fetch/node-fetchTypeError: Cannot read properties of null (reading 'body') after update from 3.2.4 to 3.2.5 on 302 status code#1574.
Read more >How To Fix the HTTP 302 Error (5 Methods) - Kinsta
HTTP 302 codes are useful to temporarily redirect website users to another URL. If you're getting this error code, here are 5 ways...
Read more >S3Exception: null (Service: S3, Status Code: 302 ) · Issue #3104
To debug the issue, I have written a test standalone application (AwsReadAllObjects. java) using the same code as the application.
Read more >3216341-33.patch - Drupal
if (selector === null) { - elements = []; - } - // The selector is undefined, error out. - else if (!selector)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
#1578 was just released, could you try the newest version?
good, closing this then