GoogleCloudPlatform/iot-smart-home-cloud

HTTP Error: 400, This operation is not available for Cloud Firestore projects in Datastore Mode.

sw-dev-code opened this issue · 4 comments

I'm getting following error after firebase deploy:

firebase deploy
  functions: package.json indicates an outdated version of firebase-functions.
 Please upgrade using npm install --save firebase-functions@latest in your functions directory.

=== Deploying to 'smarthome-272813'...

  deploying database, storage, firestore, functions, hosting
  database: checking rules syntax...
  database: rules syntax for database smarthome-272813 is valid
  firebase.storage: checking storage.rules for compilation errors...
  [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).
  firebase.storage: rules file storage.rules compiled successfully
  firestore: reading indexes from firestore.indexes.json...
  cloud.firestore: checking firestore.rules for compilation errors...
  [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).
  cloud.firestore: rules file firestore.rules compiled successfully
  functions: ensuring necessary APIs are enabled...
  functions: all necessary APIs are enabled
  storage: uploading rules storage.rules...

Error: HTTP Error: 400, This operation is not available for Cloud Firestore projects in Datastore Mode.
  firestore: uploading rules firestore.rules...

How can I solve this issue?

Did you create your cloud project according to the instructions in the README, or were you using a previous GCP project? This value is generally set on project creation for Firestore and cannot be changed, so you may need to create a new GCP project to try this sample.

In order to use the Firebase console and tools with Firestore, the project's database setting must be in Native mode. This is generally set automatically by the Firebase console when Firebase is added to the project in the README steps.

Here are some more details on Datastore mode vs. Native mode

@devunwired Thanks, that solved my issue. I'm using all the instructions from README, but I have to change database settings to Native mode. Now I have new error:

λ firebase deploy
  functions: package.json indicates an outdated version of firebase-functions.
 Please upgrade using npm install --save firebase-functions@latest in your functions directory.

=== Deploying to 'smarthome-272813'...

  deploying database, storage, firestore, functions, hosting
  database: checking rules syntax...
  database: rules syntax for database smarthome-272813 is valid
  firebase.storage: checking storage.rules for compilation errors...
  [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).
  firebase.storage: rules file storage.rules compiled successfully
  firestore: reading indexes from firestore.indexes.json...
  cloud.firestore: checking firestore.rules for compilation errors...
  [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).
  cloud.firestore: rules file firestore.rules compiled successfully
  functions: ensuring necessary APIs are enabled...
  functions: all necessary APIs are enabled
  storage: uploading rules storage.rules...
  firestore: uploading rules firestore.rules...
  firestore: deployed indexes in firestore.indexes.json successfully
  functions: preparing functions directory for uploading...

Error: Error parsing triggers: Cannot find module './service-account.json'
Require stack:
 D:\Projects\Projects\Upwork\Kimberly Hachaso\iot-smart-home-cloud-master\firebase\functions\smart-home\report-state.js
 D:\Projects\Projects\Upwork\Kimberly Hachaso\iot-smart-home-cloud-master\firebase\functions\index.js
 C:\Users\User\AppData\Roaming\npm\node_modules\firebase-tools\lib\triggerParser.js

Try running "npm install" in your functions directory before deploying.

Thanks, that solved my issue.

Glad to hear it.

Now I have new error:
Error parsing triggers: Cannot find module './service-account.json'

This is an issue with the setup instructions we need to fix. You can find more details in the comments of issue #2 to work around it for now. Closing this issue related to the database mode.

snuup commented

I face the same error:

Error: HTTP Error: 400, This operation is not yet available for Cloud Firestore projects in Datastore Mode.

I switched explicitly back to "Native Mode" - a weird name by the way - and now face this error.

The whole google cloud product is a nightmare, error messsages are constantly opaque. Think about this message:

 Error: HTTP Error: 400, This operation is not yet available for Cloud Firestore projects in Datastore Mode.

Which is "this operation" - can you please answer this question.