Skip to main content

All Questions

0 votes
2 answers
64 views

NodeJS Async function called once only in a loop

Following is my code structure. I have two async functions from source.js and db.js. I'm exporting these functions and calling them in test.js. test.js calls the function async loadFromFile() to read ...
F Baig's user avatar
  • 359
0 votes
0 answers
41 views

NodeJS v14: issue feeding in multiple commands to living spawn process and extracting output

I'm trying to create a wrapper which uses spawn process (and keep it alive) so that I can pass in several powershell commands one at a time. Where the expectation is for the command to fully execute ...
shen's user avatar
  • 35
0 votes
0 answers
25 views

await is only valid in async functions and the top level bodies of modules nodejs [duplicate]

Basically using Nodejs I connect to mysql and create a pool using below code which works fine, db.js const mysql = require("mysql") exports.database = mysql.createPool({ host: "...
micronyks's user avatar
  • 55.1k
-3 votes
0 answers
80 views

Does this specific pattern synchronize the specified awaited asynchronous calls? [duplicate]

Does this specific pattern synchronize the specified part of this function? Synchronization can be implemented variously; however, I would like to know if this specific pattern accomplishes ...
stackhatter's user avatar
0 votes
2 answers
81 views

Calling .then within a new Promise() javascript [duplicate]

I've learned javascript async/await before learning promise.then() syntax, and I am now attempting to go back and learn promise.then(). I currently have the following code let getDatabaseData = async (...
JackG's user avatar
  • 11
1 vote
1 answer
36 views

node-genius-lyrics: await is only valid in async functions and the top level bodies of modules

I am running the example code given from node-genius-lyrics after installing the package through npm const Genius = require("genius-lyrics"); const Client = new Genius.Client(myClientID); ...
streetlight006's user avatar
0 votes
0 answers
19 views

NodeJS await moveing on before function returns [duplicate]

i am downloading images using this function (downloads 30 images) async function downloadImages(imagesList) { imagesList.forEach(async element => { if (!checkForImage(element.filepath)) ...
YelloElefant's user avatar
1 vote
1 answer
56 views

Turn not awaited unhandled erroneous promise into warning @ processTicksAndRejections (created by throw error in "then")

there is no await on top-level allowed and my expectation was that the error thrown below would be logged as warning only but it turns out to be a blocker for completion, i.e. upon statement await ...
CSeitel's user avatar
  • 53
0 votes
1 answer
48 views

Asynchronous Calls With Axios client in batches keeps on waiting

For the below code, I am encountering an issue where my code is not receiving responses from the Axios API calls, even though the requests are reaching the server and the server is responding. As a ...
Ashish Malhotra's user avatar
0 votes
3 answers
105 views

javascript MySQL - using Promise-await-async constructs, can't get code to wait for query completion

I've tried multiple versions of example code but can never seem to get something that guarantees completion of the query set before other code commences. I was under the impression that 'await' makes ...
user55836's user avatar
0 votes
2 answers
49 views

Node.js function partially completing even with Async/Await implemented

I cannot for the life of me wrap my head around what I am doing wrong with this Async/Await concept. Here is my Node.js code below (two separate files). So, the console.log("...
personwholikestocode's user avatar
0 votes
2 answers
43 views

node js crashing, saying a variable is undefined, when it isnt

Here is my GET request handler, to render a page: app.get("/:band", async (req, res) => { const page = req.params.band; try { const result = await db.query("SELECT * FROM ...
user23771495's user avatar
0 votes
1 answer
57 views

Pass a variable or value in async await API vue js/laravel

I have an API and what I want is to pass the value of the email, to see if the email exist or not from the API, but every time I run it and check the console log, it returns undefined? Anyone here can ...
babe_engineer's user avatar
0 votes
0 answers
41 views

about nodejs async function [duplicate]

i'm learning nodejs, here is my confusion: enviroment: os:windows nodejs: v18.19.0 code: const sleep = (seconds) => { const milliseconds = seconds * 1000; return new Promise((resolve) => ...
qwrdxer's user avatar
0 votes
1 answer
55 views

Render waiting page while waiting for express JS to finish an asynchronous task

Ok, either this is so basic that it's dump or very complicated and not doable but I can't seem to find an answer after digging around for more than 3 hours. It's gotta be quite common and I'm just to ...
Marco Blanchette's user avatar

15 30 50 per page
1
2 3 4 5
156