Questions tagged [promise.all]
104 questions
0
votes
0 answers
Jest testing Promise.all assignment to variable when rejection
I have a Promise.all with async calls to three different services and assigns the resulting lists to three variables
const { getList1 } = require('./module1');
const { getList2 } = require('./module2');
const { getList3 } =…

Ridhwaan Shakeel
- 981
- 1
- 20
- 39
0
votes
0 answers
Puppeteer route hanging on second run
Here's a service I'm running on a Debian 10 VPS:
require("dotenv").config();
const express = require("express");
const puppeteer = require("puppeteer");
const app = express();
app.use(express.json());
app.post("/create-inbox", (req, res) => {
…

Anthony Evans
- 13
- 4
0
votes
2 answers
Use async await with Array.map not working
I've used this approach, it should give me the Expected Output which I've mentioned below.
But, due to asynchronous execution, it is giving the Actual Output.
So, Please help me to solve the same.
See, I'm calling one async function, inside i'm…

Vasanth Ram
- 3
- 2
0
votes
2 answers
Clueless about format of returned json data from fetch
This is likely a simple question for many, however I find it extremely confusing. I have a 'double fetch' using a 'Promise.all' as…

Pangit
- 564
- 1
- 7
- 23
0
votes
1 answer
Javascript warning "await has no effect on the type of this expression" in combination with Promise.all
Below is a minimized code snippet which causes the async warning in VS code (most recent version 1.70.). It is part of a load balancing algorithm which is to execute asynchronous tasks.
When the generateTask function returns a promise directly the…

Matthias
- 26
- 3
0
votes
1 answer
Update an Object in an Array with Node SQL request
I'm having hard time with an array update in Node. Here is my problem : I make an API call to receive an array like this
[{id:1 name:x ...}{id:2 name:x ...} ]
I want to pass each line of this array to another query to update the name key (from…

Arthur Fortin
- 103
- 1
- 10
0
votes
1 answer
executing multiple await promise.All not catching the error correctly
im trying to execute multiple pormises in chunks using promise all => this is just a code example - throwing every time getting the number 72.
i have a simple catch in the function that calls executePromises but it does not catch as it should.
the…

Rawi Lahiany
- 11
- 4
0
votes
0 answers
typescript promise.all recieving many types
i have a code that needs many different promises to solve before proceding with some computation. just for info, the promises are concerning accessing database.
for example:
const house= await database.getTheHouse();
const person= await…

Josep Antoni
- 11
- 3
0
votes
0 answers
Leverage promise.all() to return default data used throughout site. Data not available when called
After working with the helpful comments below, the solution settled in as follows:
async function grab_sysLvl_phase_program_mission() {
const sysLvl = get("/api/SystemLevelList_url/").catch(err=>showErrorAlert(err));
const phase =…

Terry Dunlap
- 25
- 6
0
votes
2 answers
how to fetch multiple url and (how to verify if url is working before i fetch it) with js
I have been looking at Promise.all for fetching multiple urls. I know that we can use Promise.all and pass an array there, and then fetch the content.
Let's say I have two URLs in an array but one of them is not working. How can I still use…

Vinicius Chinen
- 21
- 1
- 5
0
votes
1 answer
Reading multiple files and uploading to AWS S3
Requirement:
I have multiple files in a folder on my express server. I pass these file names as an API call, the backend function needs to read all these files, upload them to AWS S3 and then return an array of public URLs.
const s3 = new…

unni_ramachandran
- 63
- 7
0
votes
1 answer
get data from promiseresult object of promise.all and axios call
I am using the following code and my aim is to get the data from the data section of the PromiseResult object of the returned Promise. I am using the following code:
const promiseComment = axios.post(`${BASE_URL}/api/addComment/`, data,…

Web World
- 21
- 4
0
votes
0 answers
Promise.all() does not give results separetely
I'm working on a React project where I have to make multiple API calls. So, the way I have been doing is using Promise.all(), but it returns all the results at the same time which sometimes too slow and bad for users' experience. I wonder if there…

Thi Nguyen
- 49
- 2
- 6
0
votes
1 answer
How to put result of Promise.all at specific place?
Is there any way to use Promise.all in my case ?
Should i use two different loop (one to push in an array of promise and another to push each result to the right place) ?
(This is just an example and my current code contains much more data, so using…

mgabi9
- 13
- 4
0
votes
1 answer
Use Promise.all() inside mongodb transaction is not working propertly in Nestjs
Hi I am working in a NestJS project using mongodb and mongoose.
I have to create transactions with a lot of promises inside, so i think it was a good idea to use Promise.all() inside my transaction for performace issues.
Unfortunately when i started…