Error: Functions did not deploy properly

Try running deploy with --debug. For example: firebase --debug deploy.

In my case the function looked like this:

exports.test = functions.firestore.document('chats').onCreate((snap, context) => {
   ...
});

The debug log contained the following error message:

fieldViolations=[field=event_trigger, description=Expected value chats to match regular expression [^/]+/[^/]+(/[^/]+/[^/]+)*]]

And that's when I realized that chats is not a document but a collection. I changed the path to that of the collection and everything worked fine.

EDIT:

To view more logs you can also try:

firebase functions:log

or

firebase functions:log --only <FUNCTION_NAME>

Link to documentation.


I had the same issue with Firestore ,my problem was that the path to the document was bad. I had a slash at the beginning and the end of the path to my document like I used to do with Firebase Realtime Database path. Hope it helps someone.


Just close whatever IDE you're using and then reopen it. Then on node redeploy your functions. This should resolve the issue.


I got this error as well, I had the problem that a dependency was missing in the package.json file.

By running firebase --debug deploy it returned an error on the user code. firebase functions:log gave then the specifics, that a package was not included.


Check your json modules dependencies inside functions folder. There's an specific json package there. If some module you are including in the project and is not there (in json) you probably will have the error mentioned. To install just run:

npm install <module> --save

or

yarn add <module> --save

and then run your deploy again:

firebase deploy --only functions