question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: how to debug hang in node-fetch? (likely environmental issue)

See original GitHub issue

On my Windows 10 dev box, Node 12.17.0, I’m seeing the following code hang:

let result = await fetch("https://sadchonks.com/kitteh-512.png"); // success, 200
let buffer = await result.buffer(); // This hangs, never finishes. No errors, no result. Just hang.

I’m trying to figure out why this hangs. Stepping into the debugger, I reach into consumeBody function, but neither body.on('error', ...) nor body.on('data', ...) never fires:

image

I’ve also tried de-asyncing my code by using .then(…) chains without async. Still no dice; it hangs on the same call to .buffer().

Any suggestions for debugging this hang?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
goldalwormingcommented, Apr 17, 2021

It still happens and happen accidently. It’s so hard to reproduce and try catch is not work to handle this.

t’s bugged in long run system and became unpredicted. anybody have solution?

I use node 13.6.0

3reactions
pilotofbalancecommented, Feb 7, 2021

able to reproduce by fetching images in loop, buffer is hitting maximum size and just hanging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodejs process hang, how could I debug it or collect dump?
This tool helps with processes which have completed their work but not exited the vm. It does not help with infinite loops, which...
Read more >
API Docs | fetch-mock - Wheresrhys
The first step when debugging tests should be to run with the environment variable DEBUG=fetch-mock* . This will output additional logs for debugging...
Read more >
rollup.js
rollup.config.js import fetch from 'node-fetch'; export default ... You will rarely need to use this, and should probably be using the command line...
Read more >
Load API endpoint sometimes times out - Caddy Community
When it does get “stuck” everything returns to normal after “socket hung up” error. I have no ideas what may be the problem....
Read more >
How to Build with Twilio Functions for JavaScript Beginners
There was just one problem. After desperately rummaging through the rental's kitchen cabinets, I found only a single tablespoon hanging ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found