Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Async/Await no funciona en las funciones de la nube de Google

Trabajo con las funciones de la nube de Google y la mensajería en la nube en Firebase. Sin embargo, cuando trato de usar las funciones Async/Await, aparece un error: error Parsing error: Unexpected token => Trabajo con Node.js v16.

Aquí está mi código:

 const functions = require("firebase-functions"); // const mess = require("firebase/messaging"); const admin = require("firebase-admin"); exports.sendListenerPushNotificationProductUpdate = functions.database .ref("Products/{product}/type/") .onUpdate(async (snapshot, context) => { ... const tokensSnapshot = await Promise.resolve(getDeviceTokensPromise); console.log("TOKEN: " + JSON.stringify(tokensSnapshot)); // Check if there are any device tokens. if (!tokensSnapshot.hasChildren()) { return functions.logger.log( "There are no notification tokens to send to." ); } ... // Listing all tokens as an array. const tokens = Object.keys(tokensSnapshot.val()); // Send notifications to all tokens. const response = await admin.messaging().sendToDevice(tokens, payload); // For each message check if there was an error. const tokensToRemove = []; return Promise.all(tokensToRemove); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿ getDeviceTokensPromise devuelve una Promise ? Si es así, esa línea debería ser

 const tokensSnapshot = await getDeviceTokensPromise()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!