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

130
Views
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 answers
Answer question

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 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!