0
votes

I managed to move data between projects using the instructions as per this guide: Moving data between projects.

During the import, I got an error:

ERROR: (gcloud.firestore.import) PERMISSION_DENIED: The Cloud Firestore API has not been used in project XXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firestore.googleapis.com/overview?project=project-name and then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

I enabled Cloud Firestore API and completed the import process.

Now, on Firebase console, when I go the Cloud Firestore page of the destination project, I see this message:

This project is set up to use Cloud Firestore in Datastore mode. This mode can only be accessed from Google Cloud Platform

This project is set up to use Cloud Firestore in Datastore mode. This mode can only be accessed from Google Cloud Platform

The import command creates the Cloud Firestore database in Datastore mode. And it's not possible to switch it back Native mode as the first write on the database executed.

How can I import the data in Cloud Firestore Native mode?

1

1 Answers

1
votes

I understand the import operation coerced the type of the new project database to Firestore in Datastore mode instead of Firestore Native, which was the mode of the database you exported the data from.

I have opened the following issue tracker so that this behavior could be investigated in further detail. I would recommend to star the issue and add your mail in the CC list so that you're aware of the updates made therein.

Separately, once the first write has been commited to the database it's no longer possible to change the database mode, therefore you'll have to create another project to use Firestore in Native mode.

To that effect I have tested the following workaround so that you could succesfully make the import in a new project:

  1. Create a new project. Then go to the Firebase Console and create a Firestore database.
  2. Using the console, create a mock collection and a mock document within it.
  3. Proceed with the import as outlined in the documentation.

After completing these steps you could delete the mock collection and keep with your development as usual.