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

176
Views
No se puede obtener valor del niño agregado con funciones en la nube

Estoy tratando de obtener el valor de un niño que se agregó a mi base de datos con funciones en la nube y luego enviar este valor con una notificación automática a mi aplicación móvil. El problema es que firebase en lugar de darme el valor del niño me da un [Objeto Objeto] y no puedo encontrar el problema dentro de mi código.

Lo intenté:

  • Usando snapshot.after.val().keyName;
  • Usando instantánea.después.val()[0]; Esto es devuelve undefined

Mi index.js:

 //import firebase functions modules const functions = require('firebase-functions'); //import admin module const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.pushNotification = functions.database.ref('/users').onCreate((snapshot, context) => { // Get the current value of what was written to the Realtime Database. const valueObject = snapshot.after.val(); functions.logger.log("value is: " + valueObject); // Create a notification const payload = { notification: { title: "Value is: " + valueObject, body: "This is a test", sound: "default" } }; //Create an options object that contains the time to live for the notification and the priority const options = { priority: "high", timeToLive: 60 * 60 * 24 }; return admin.messaging().sendToTopic("pushNotifications", payload, options); });
about 4 years ago · Juan Pablo Isaza
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!