2
votes

I've been deployed HTTP and Storage triggered functions with no problems. When I deploy a firestore event (.onUpdate or .onWrite) function it never triggers. When I look at the console (detailed info) I see all my functions with the correct trigger type listed, except for the firestore functions which show 'unknown'.

firebase-tools: [email protected]

Below are two sample cloud functions. The first, 'fred' with 'firestore.document' shows up with trigger type: 'unknown'. The second 'makeUpperCase' is a test that triggers off the Realtime database (which I don't really use) but when it's loaded, it does show the correct trigger type in the console.

I'm not sure if I'm missing something really simple, or this is a firestore bug. (I did load a firestore trigger function that I had working a few months ago and it also didn't trigger properly, which leads me to suspect Firestore problem.)

export const fred = functions.firestore.document('users/{userId}').onWrite(event => {
    console.error(`fred triggered: ${JSON.stringify(event.data.previous.data())}`);
    return new Promise((resolve, reject) => {

        resolve();
    })
})

exports.makeUppercase = functions.database.ref('/organizations/{pushId}')
    .onWrite(event => {
      // Grab the current value of what was written to the Realtime Database.

      console.log('Uppercasing');
      return new Promise((resolve, reject) => {

        resolve();
    })
    });
1
This sounds like it should be a Firebase bug report, not a Stack Overflow question. firebase.google.com/support/contact/bugs-featuresDoug Stevenson
Most likely, I've posted here because many bugs are just simple overlooked types! I've just been able to show that the same code works on a different firebase project and am opening a FB bug.joelm

1 Answers

0
votes

Firebase Cloud Functions are running on node v6.11.5

export const fred = is not supported. Use exports.fred = instead.

Same as with your realtime database example.