I'm trying to deploy a single cloud function while debugging using the following command:
$ firebase deploy --only functions:trig-users-onUserUpdate
But I get this error:
i functions: current functions in project: trig-auth-createAuthUser(us-central1), trig-auth-onDeleteUser(us-central1), trig-users-onUserUpdate(us-central1)
⚠ functions: the following filters were specified but do not match any functions in the project: trig-users-onUserUpdate
When I do deploy all functions I see it in the list:
✔ functions[trig-users-onUserUpdate(us-central1)]: Successful update operation.
I tried adding the (us-central1)
but I get this error:
bash: syntax error near unexpected token `('
Any ideas what I am doing wrong?
There seems to be an issue with modules/directories that are imported.
In my case, my index.js
was structured like so:
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp()
const users = require('./triggers/users')
const posts = require('./triggers/posts')
const triggers = {
users,
posts
}
exports.trig = triggers
To make it work, replace the -
that firebase adds in the name with .
and it works so:
// WRONG
$ firebase deploy --only functions:trig-users-onUserUpdate
// RIGHT
$ firebase deploy --only functions:trig.users.onUserUpdate
See discussion with the team here: github polish