FIRESTORE - Import failed

Hello!

I was trying to import some data from a firestore collection to another. In order to achieve this, I used the export feature in project1. Now, I'm inside my project2 trying to do import but with no luck. Here are some screenshots. Am I doing something wrong? 

Screenshot 2024-05-02 at 14.24.21.png

Import screenshot 1Import screenshot 1

 

 

 

Import screenshot 2Import screenshot 2

 

 

Error screenshotError screenshot

 

--
Best regards
David Regalado
Web | Linkedin | Cloudskillsboost

1 3 87
3 REPLIES 3

The error message specifies the path to the file as /boozeco-evidente-test-david/boozeco-evidente-test-david.overall_export_metadata, which seems to be missing or incorrectly specified. Here's a step-by-step approach to troubleshoot this issue:

  1. Verify File Existence: Ensure that the file actually exists in the specified location in your Google Cloud Storage bucket. You can check this using the Google Cloud Console or via the Cloud Shell with the command:

    gsutil ls gs://boozeco-evidente-test-david/

    This command lists all files in the bucket. Look specifically for the file named boozeco-evidente-test-david.overall_export_metadata.

  2. Check Path in Import Command: Ensure that the path specified in your import command is correct. Based on your message, the path seems to be duplicated (/boozeco-evidente-test-david/boozeco-evidente-test-david.overall_export_metadata). Make sure that the path you use matches exactly with where the file is located in the storage bucket.

  3. Use Full Path in Commands: When referencing your file in commands, use the full path from the bucket root, and ensure there are no typographical errors:

    gsutil ls gs://boozeco-evidente-test-david/firestore-exports/

    This can help you verify the file's presence and exact location within subdirectories.

  4. Correct Command Format: When importing to Firestore, ensure your command is correctly formatted. Generally, the command to import data from a Google Cloud Storage bucket to Firestore looks like this:

    gcloud firestore import gs://[BUCKET_NAME]/[PATH_TO_EXPORTED_DATA]

    Replace [BUCKET_NAME] and [PATH_TO_EXPORTED_DATA] with your bucket name and the path to the folder containing your Firestore export.

  5. Permissions and Access: Verify that your Google Cloud account has the necessary permissions to access the Google Cloud Storage bucket and perform import operations in Firestore.

 

2. Check Path in Import Command: Ensure that the path specified in your import command is correct. Based on your message, the path seems to be duplicated (/boozeco-evidente-test-david/boozeco-evidente-test-david.overall_export_metadata). Make sure that the path you use matches exactly with where the file is located in the storage bucket.

But that part was generated internally by the console. This is an UI issue.

--
Best regards
David Regalado
Web | Linkedin | Cloudskillsboost

 

Thanks clarification. Here are a few steps you can try to work around this problem:

  1. Manually Specify the Correct Path: Instead of relying on automatically generated paths or commands, you can manually construct the import command with the correct path to the Firestore export metadata file. Ensure that the path is typed correctly and corresponds exactly to the location and name of the file in your Google Cloud Storage bucket.

  2. Use Cloud Shell or gsutil Directly: If the Console UI is causing issues, you might have better success using the Cloud Shell or gsutil directly to perform your operations. You can execute the Firestore import command like this:

 

gcloud firestore import gs://[BUCKET_NAME]/[PATH_TO_EXPORTED_DATA]

Make sure to replace [BUCKET_NAME] and [PATH_TO_EXPORTED_DATA] with the accurate bucket name and file path.