Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
firestore trigger functions not uploading to the firebase database

I am currently working on a web application to where a customer can come and request a private event for a valet company. I am trying to set up a trigger function so it can send an email to the owner evertytime someone requests a private event. I currently ahve this code set up in my email.js file

 const functions = require('firebase-functions');
 const admin = require('firebase-admin');
 admin.initializeApp();

 const db = admin.firestore();

exports.onQuoteAdded = functions.firestore.document('Manager/Quote/Quotes').onCreate( (snap, context) =>{
const values = snap.data();

//send email

db.collection('login').add({ description: 'Email was sent'});

});

I try to do the firebase deploy --only functions. I do that it says deployed succesfully. I then go into my firestore i add a new file under Quotes and nothing happens. I then also check the functions page within firebase and it says waiting on your first deploy. Does anyone know what i could to to figure out where the errror is.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The Cloud Function defined with functions.firestore.document('Manager/Quote/Quotes').onCreate() cannot deploy correctly because you are passing a wrong path to the document() method.

You need to pass a path that points to a Document, i.e. the path must contain an even number of slash-separated path elements, like:

functions.firestore.document('Manager/Quote').onCreate()

or

functions.firestore.document('Manager/{quoteId}').onCreate()

or, for a subcollection,

functions.firestore.document('Manager/{ManagerId}/subColl/{docId}').onCreate()


You most probably want to use a wildcard, as shown in the second option above and as detailed in the documentation.


I would also suggest you watch the 3 videos about "JavaScript Promises" from the Firebase video series which emphasize how it is important to correctly manage the Cloud Function life cycle, by returning a Promise when all the asynchronous work is complete.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda