Question

Error: HTTP Error 400, The Request has errors. Firebase Firestore Cloud Functions

While I run the command firebase deploy I get this error:

i deploying functions

i functions: ensuring necessary APIs are enabled...

i runtimeconfig: ensuring necessary APIs are enabled...

✔ runtimeconfig: all necessary APIs are enabled

✔ functions: all necessary APIs are enabled

i functions: preparing functions directory for uploading...

i functions: packaged functions (4.04 KB) for uploading

✔ functions: functions folder uploaded successfully

i starting release process (may take several minutes)...

i functions: creating function followerNotification...

⚠ functions: failed to create function followerNotification

⚠ functions: HTTP Error: 400, The request has errors

⚠ functions: 1 function(s) failed to be deployed.

Functions deploy had errors. To continue deploying other features (such as >database), run: firebase deploy --except functions

Error: Functions did not deploy properly.

Having trouble? Try firebase deploy --help

Everything else works without problems. Only when I trying to make something with Firebase Firestore.

 46  19080  46
1 Jan 1970

Solution

 112

This was happening to me too, then I realized that at the 2nd level, firestore only allows documents and not collections.

I was attempting to listen to this path:

/collection/document/{wildcard}

You can either do something like

/collection/{wildcard}

or

/collection/document/collection/{wildcard}
2017-10-23

Solution

 13

I had this problem as well. In my case it was because my trigger path had a trailing slash in the document path.

So changing:

functions.firestore
  .document('some_path/{pushId}/')

To:

functions.firestore
  .document('some_path/{pushId}')

Fixed it it for me. It seems like this is caused by a variety of issues and the firebase cli does not do a good job at explaining the reasons why.

2018-02-08