Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 517
Loyal Avatar asked Oct 18 '17 19:10

Loyal


2 Answers

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}
like image 157
Ivan Avatar answered Nov 06 '22 17:11

Ivan


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.

like image 13
adamduren Avatar answered Nov 06 '22 16:11

adamduren