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

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}

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.


For me none of the answers helped me. In the end I got a list of steps (from Google) to pinpoint the problem. If you run:

firebase --debug --only functions deploy

it will give a more detailed error-message, what was in my case:

HTTP RESPONSE BODY <?xml version='1.0' encoding='UTF-8'?><Error><Code>EntityTooLarge</Code><Message>Your proposed upload is larger than the maximum object size specified in your Policy Document.</Message><Details>Content-length exceeds upper bound on range</Details></Error>