Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda