Tags down


async await promise.all map not resolving promises

By : John Geyer
Date : October 18 2020, 06:10 PM
To fix the issue you can do Using asnyc/await doesn't make the results function synchronous. (It's literally tagged as async!) So it returns a promise, and you have to await that before logging the values:
code :
const arr = [1, 2, 3];

const results = Promise.all(
  arr.map(async item => item + 1)

(async () => {
  console.log(await results)

Share : facebook icon twitter icon

How do I async await multiple promises in parallel? [Syntax Error: await is a reserved word]

By : Matt S
Date : March 29 2020, 07:55 AM
wish of those help You have placed the await in the map callback function, not in the one that is declared as async. You'll want to use
code :
async function getAuthors(authorIds) {
  await Promise.all(authorIds.map(id =>

Promise not resolving using async and await

By : Michael Zou
Date : March 29 2020, 07:55 AM
hop of those help? An async function returns a promise
Your issue is that currently, you're trying to log the result of an asynchronous function which is always a Promise, to remedy this, place your console.log in the async function.
code :
async function returnUsernameViaUserid(userId) {
  const result = await retrieveUserFromFB();

function retrieveUserFromFB() {
  return new Promise(function(resolve, reject) {
    setTimeout(function() {
      resolve({user: 'thisistheusername'});
    }, 1000)


async/await Promise.all() but get response as the promises resolve

By : user3134304
Date : March 29 2020, 07:55 AM
To fix this issue Iterate over the promises with forEach instead, attaching processData to each in a .then:
code :
const processData = console.log;

let p1 = Promise.resolve(1);
let p2 = Promise.resolve(2);
let p3 = Promise.resolve(3);
[p1, p2, p3].forEach(prom => prom
  .catch((err) => {
    /* handle errors */

How do I move from promise chaining to async/await multiple promises?

By : searchingforpants
Date : March 29 2020, 07:55 AM
Hope this helps I've searched a lot, tried many things but I can't come to a clean conclusion. I'm chaining a lot of Promises: , Utilizing Promise.all we are able to parallelize requests:
code :
.then(([installedComponents, demosCategories, demosData]) => ({
  "installed-categories": { data: installedComponents },
  "demos-categories": { data: demosCategories },
  "demos-data": {data: demosData}
.catch(e => handleSomeErrorForAnyOfRequestsAbove(e))
const result = {};
try {
  const [installedComponents, demosCategories, demosData] = await 
  result["installed-components"] = installedComponents;
  result["demos-categories"] = demosCategories;
  result["demos-data"] = demosData;

} catch(e) {

Promises and async await is not working -Unhandled Rejection at: Promise Promise { <rejected> 'noData' } reason: u

By : user3617320
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I'm stuck past few days I'm using openshift modules to fetch all the pods and their status using node.js , Following works
code :
               let fetchListarr=[];
                    aws_app.get('/path', async (req,res) =>
                            Promise.all(promisesArray).then(values => {
                            // do stuff with values here
                        catch (e){throw e;}
                    var WMArr=[];
                    var prom1 = new Promise(function(resolve, reject) {      
                            let config = {
                            user: 'username',
                            password: 'passowrd',
                            strictSSL:  false  
                                                    pods.map((v)=> {                                                                                                                                                            
                                                                {   let obj={"TargetServiceName":v.object.metadata.labels.app,"Instance":WMArr.lastIndexOf(v.object.metadata.labels.app)===WMArr.indexOf(v.object.metadata.labels.app)?1:WMArr.lastIndexOf(v.object.metadata.labels.app)+1,"Status":v.object.status.phase}
                                                    setTimeout(function() {                      
                                                    resolve( fetchListarr);                           
                                                    }, 5000);
                                        .catch(err=>{throw err}) 
                    var promisesArray= [prom1]; 
Related Posts Related Posts :
  • Set field in mongoose document to array length
  • disable Double tap zoom/resize on safari IOS12***
  • how to add a wait in time in a for ..of?
  • Time Spent by user on a web page + Iframe
  • animate.css is not working in Chrome latest version (Version above 73)
  • Row selection and pagination - Vue
  • How can I use function chaining with dates in JavaScript?
  • What is the difference between "delete" and "Reflect.deleteProperty()"
  • How to get attributes of individual elements in jquery array
  • Why do I get different results with "=" vs. "===" in javascript with Conditional (Ternary) Operators
  • I am trying to hold value of document.getElementById("image").src=UserInput +".gif"
  • Array being pushed into another array isn't displaying
  • Is there a React.js NPM module or any other solution for image/object mutli-selection?
  • 80% Javascript Solution for Flags in Codility
  • I want to display background while scrolling down
  • RegEx for matching text between two tags
  • Does having a lot of inner 'helper' functions inside a functional stateless react component will result in worse perform
  • How to submit a form through a button outside the form?
  • ESLint: Use callback in setState when referencing the previous state
  • How to parse state from one component to another in my example?
  • Visible Html select option showing under hidden items
  • Create SVG circle using path with 6 segments
  • Getting error while reading from a text file
  • Read a value from JSON Array without entity
  • Checkbox check or uncheck value null
  • Displaying multiple slider values to users
  • Am doing the destructing right?
  • VueJS data-bind object styling not working
  • Combine array and object destructuring
  • Execution skips promise statements
  • sort an array of objects leaving first field
  • how to highlight table cells in a certain way when hover over
  • Problems when using Chosen Selectors in external helper functions
  • Need to merge two objects together that each have an array to the matching IDs
  • How to get previous 6 months date from current date in javascript
  • how to get object value only without mentioning key from array list using ngFor in angular 7
  • Plugging into on_page_change events in testcafe
  • WithStore: Cannot read property 'state' of undefined (pure-react-carousel)
  • fullcalendar event info in modal popup
  • How do i reduce time complexity of this code
  • Deep comparing object props in React not working as expected
  • JavaScript method to remove case insensitive duplicates from string/Numbers
  • When to use parentheses after function name call (es6)
  • Convert list of Objects when the levels are given in an array
  • template variable always undefined ngOnChanges
  • RegEx for matching the first word
  • Render different au-target-id in aurelia repeat
  • Why does the function start before the button is pressed?
  • where can I vote for changes to javascript?
  • Change the digit format pagination in the slider
  • Hover/focus state activated initially on page load
  • Why do my normal sync codelines, works like async?
  • How to prevent or disable Bootstrap 4 popover auto positioning behavior (Self adjusting behavior)
  • What is the meaning of ({})?
  • How do I make a link to a property if the property is yet to be declared? (In a Class)
  • Getting Promise as return value inside FlatList React-native
  • Why can't you access JSON directly from the response in Fetch API?
  • How to grab value out of this nested array
  • function is not returning any value
  • "Cannot read property 'map' of undefined (React.js)"
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk