Lahari Areti
Lahari Areti

Reputation: 637

Firebase firestore: Cloud functions are not deploying properly

I am trying to get the document data from the cloud firestore using cloud functions.But I am getting an error Failed to configure trigger providers/cloud.firestore/eventTypes/[email protected] (Split)

Error: Functions did not deploy properly.

I tried many options like updating my firebase tools, changing function name and deployed but still am getting the same error. Here is the code

const functions = require('firebase-functions');
        const Firestore = require('@google-cloud/firestore');
        const firestore = new Firestore();
        const admin = require('firebase-admin');
        admin.initializeApp(functions.config().firebase);
        const db = admin.firestore();
        exports.splitting = functions.firestore
            .document('deyaPayUsers/{authid}/Split/{authid}/SentInvitations/{autoid}')
            .onWrite(event =>{
            const ID = event.params.authid;
            const splitid = event.params.autoid;
            var document = event.data.data();
            //retrieve the data from the database and stored into document
            var ph1 = document.Invite1.PhoneNumber;
            console.log(document);
            console.log(ph1);
           });

My Database Path is

/deyaPayUsers //collections
{authid}    //Document
/Split      //Collection
{authid}    //Document
/SentInvitations //Collection
{autoid}         //document
   Invite1     //object
     PhoneNumber: 987654321, //number
     Amount:21               //number

Upvotes: 4

Views: 1266

Answers (1)

Bob Snyder
Bob Snyder

Reputation: 38319

The authid wildcard is used twice:

.document('deyaPayUsers/{authid}/Split/{authid}/SentInvitations/{autoid}')

Use unique names for each wildcard:

.document('deyaPayUsers/{authid}/Split/{authid2}/SentInvitations/{autoid}')

Upvotes: 6

Related Questions