firebasegoogle-cloud-functionsgoogle-cloud-firestore

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.


Solution

  • 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}