Reputation: 609
I'm getting this error and I can't find why
Error:
Failed to configure trigger providers/cloud.firestore/eventTypes/[email protected]
Function:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.newSubmit = functions.firestore
.document('usersSubmit/{id}')
.onCreate(() => {
console.log('new document created');
});
The collection usersSubmit does exist as a root collection. Is it my function or is Cloud Functions having a hard time?
Upvotes: 2
Views: 847
Reputation: 994
Documenting another edge case that can cause trigger deployments to fail
I have a preferences subcollection in /users that has a single document with the user's uid as the doc id (for simplicity). I had my trigger configured as follows:
.document("/users/{userId}/preferences/{userId}")
It was working fine in the emulator, but when I deployed, I was getting a Failed to configure trigger error,
Turns out you can't use the same wildcard identifier twice in the path. I changed it to:
.document("/users/{userId}/preferences/{preferencesDocId}")
And the deployment succeeded with no errors.
Now that I think about it, it was a stupid mistake, but if you're doing what I did...don't.
Upvotes: 1
Reputation: 609
Simple! I had to add a forward slash before the root collection.
.document('/usersSubmit/{id}')
Upvotes: 5