Backendless.Messaging.publish promise not called

Hi,

App ID = 28A40095-0806-3BDD-FFC1-FED764753200

In my JS server code (timer) I am publishing a push notification. The message is delivered fine but the promise (.then) is never called. This is my (simplified) code:

let promises = []

promises.push(
Backendless.Messaging.publish(“groningen”, message, publishOptions).then(response => {
console.log("push notification has been published, message status = ", response.status);
})
)
return Promise.all(promises)

the log line in the .then function does not end up in the logging.

hello,

I took a look on your code of the Timer and figured out the problem is with Promise.all and promises array
http://support.backendless.com/public/attachments/0e25aba178cb96f72025233cbf80c777.png</img>

you have to change your code a little and it will work as you expected

Regards, Vlad

Good catch! Thanks for pointing that out. I solved it with adding another promises array and waiting for it after the first has finished.