Category "promise"

Discord.js v13 delete message after a certain amount of time

Up to discord.js v12, my bot would delete messages it posted like this : message.reply("text") .then(msg => { message.delete() msg.delete({timeout:

React Jest:- node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */);

I have below code in react. useEffect(() => { (async () => { await httpClient .get(`${config.resourceServerUrl}/invent

javascript - await promise stucks

I am implementing google video person detection . I completely followed their docs and implemented same script they provided But my code is not passing by this

Optimise multiple api requests with Promise.all()

I'm trying to optimise multiple made to an 3rd party API (Spotify) in my NestJS API. My code is working but I do not find a way to optimise it. @Get('') async

Promise allSettled is not a function

I planned updating some Promise.all to Promise.allSettled in my React Native - Expo Project but the function does not Exist. i checked all Versions and everythi

Does CefSharp support the promises of the JavaScript?

JavaScript code below works in the console of the Browser. But when i put this code in CefSharp, CefSharp returns null. Im using CefSharp 100.0.120-pre. Does Ce

Catch() is not handling rejection of promise in case multiple javascript Promises to settle with Promise.allSettled()

I can see a strange behaviour when all of the request is being failed for multiple javascript Promises to settle with Promise.allSettled, .catch is unable to ha

Simple practical example to see faster async functions and promises from node 10 to node 12, and up

Before I ask my question I want to make this clearly, I know benchmarks never tell the whole story. But my goal here is relatively simple, I want to see the per

How to return a promise with alertcontroller in ionic 4?

I am trying to convert this ionic 3 code into ionic 4 but I don't know how the promise works on ionic 4. I tried looking into the documentations and I can't fin

How to access the value of a promise?

I'm looking at this example from Angular's docs for $q but I think this probably applies to promises in general. The example below is copied verbatim from their

How to see stacktrace / cause of an error in Jest?

I'm trying to debug a nodeJS app. I have some code which causes an error, a variable is undefined. When I run the code normally, the error is very clear and eas

What is a safe and scalable way to exhaustively select all users from Amazon Cognito API in JavaScript?

I am part of a small team working on a fairly small website with user accounts; there are about 100 users at this time. And we are using Amazon Cognito for user

javascript wait until variable is set [duplicate]

Can you make a function wait until a variable is set by another function? This is my example: function setvar(){ //some process that may take

Javascript await / promise order of execution is not as expected

In my Nodejs project I would just like to await a mongoose.save function before continuing with my code. The below example does not work, but can anyone help me

async await with setInterval

function first(){ console.log('first') } function second(){ console.log('second') } let interval = async ()=>{ await setInterval(first,2000) await se

401 unauthorized browser alert after fetch call with bearer token in react

I have a get fetch request with header having Bearer token, getting 401 unauthorized error, even if the response status condition checked in the then statement,

Do not fail whole task even if one of promises rejected

In redux saga if we want to handle multiple promises, we can use all (which is equivalent of Promise.all): yield all( users.map((user) => call(signUser, u

When Updating to HttpClient: Uncaught in Promise/Http Failure during parsing

In my angular app I'm updating from Http to HttpClient, which doesn't seem to work when working with Promises. It seems like you need to use a little 'work-arou

fetch response.text() returns pending promise

I test the fetch API with jsonplaceholder URL, but my function returns "Promise State: Pending", and I don't understand why : function getUsers(url) { return

What are asynchronous functions in JavaScript? What is "async" and "await" in JavaScript?

This Q&A is aimed to give clear answers to the following questions: What are asynchronous functions in JavaScript and when and how do we use them? What are