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.

async.forever error in 2.3.0

See original GitHub issue

What version of async are you using? 2.3.0 Which environment did the issue occur in (Node version/browser version) NodeJs >= 7.6 What did you do? Please include a minimal reproducable case illustrating issue. I have a function that works for async 2.1.5

_async.forever(async function(next) {
  try {
    // do something
    next();
  } catch (err) {
    next(err);
  }
}

What did you expect to happen? This function should run the async callback function forever…I am using NodeJs >= 7.6 so async is supported natively… What was the actual result? After upgrading to 2.3.0, now I get this error TypeError: next is not a function

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
aearlycommented, Apr 7, 2017

Perhaps we should make it more clear in the docs that a final callback isn’t passed to an async function.

0reactions
sst2010commented, Nov 23, 2020

@aearly

Thanks for the response. I did figure out the throw way to break the forever loop. Although, I used throw ("true") & then checked if error. message === "true" in my catch block.

Maybe throw ( false ) won’t need error. message verification. Will try later.

Also, regarding your break solution, that is what I tried first, but node gave error: Invalid break statement & so I used forever in the first place.

Anyways, thanks again for the response. Using throw does work as a workaround to the next callback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

async - Documentation - GitHub Pages
A callback which is called when all iteratee functions have finished, or an error occurs. Invoked with (err). Returns: a promise, if a...
Read more >
neo-async - npm
Neo-Async is thought to be used as a drop-in replacement for Async, it almost fully covers its functionality and runs faster.
Read more >
async - NPM Package Overview - Socket.dev
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally ...
Read more >
About — python-logstash-async 2.5.0 documentation
While FileBeat provides similar features like python-logstash-async , there are also a few ... Otherwise retrying happens forever on non-recoverable errors.
Read more >
Easier Node.js streams via async iteration - 2ality
Throws if there are errors. await finished(writable); } await writeIterableToFile( ['One', ' line of text ...
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