caolan / async

Async utilities for node and the browser
http://caolan.github.io/async/
MIT License
28.15k stars 2.41k forks source link

Async causing issues with callback function #1894

Closed smritiRGI closed 1 year ago

smritiRGI commented 1 year ago

async version : 3.2.3 , also tried with 3.2.4 , the same error is getting generated.

Issue is happening in node version : 14.2.0

I am adding a task to the async queue and once it is processed writing the output to a file using fs module. If the file is written successfully , I am calling a callback function.

I expected the callback to get processed successfully but instead getting the below error:

**C:\Users\smriti.rastogi\Downloads\ai-resource-matching-nodejs-master\node_modules\async\dist\async.js:324 if (fn === null) throw new Error("Callback was already called."); ^

Error: Callback was already called. at C:\Users\smriti.rastogi\Downloads\ai-resource-matching-nodejs-master\node_modules\async\dist\async.js:324:36 at C:\Users\smriti.rastogi\Downloads\ai-resource-matching-nodejs-master\routes\queueRPLN.js:27:11 at FSReqCallback.oncomplete (node:fs:196:23)**

smritiRGI commented 1 year ago

I had some issues in the processing part of async queue which is solved now.

yukha-dw commented 1 year ago

Hello @smritiRGI , I have same issue when trying to execute Promise then().catch() blocks (node-fetch) inside waterfall. If you have same case, could you mind tell me how to fix it? Thank you :)