Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not import data to the emulator #859

Open
pascalbe-dev opened this issue Sep 21, 2022 · 2 comments
Open

Can not import data to the emulator #859

pascalbe-dev opened this issue Sep 21, 2022 · 2 comments

Comments

@pascalbe-dev
Copy link

When running an import for the local emulator, the data is not really imported to the firestore emulator.

Steps to reproduce the behavior

  • start the firebase emulator with a demo project ID (firebase emulators:start --project demo-my-project --config some-folder/firebase.json) (a firebase.json which includes the activated firestore emulator on port 8080 is present in "some-folder")
  • setting the FIRESTORE_EMULATOR_HOST environment variable to localhost:8080
  • running a import command, e.g.: firestore-import -y -b users.json -n users

Expected behavior

  • the data gets imported into the database (this is how it works with actual firebase projects)

Actual behavior

  • I get an error message about a missing GOOGLE_APPLICATION_CREDENTIALS variable

  • when I now point this env variable to the service account key for a different environment, the import command works (success message), but data is still not imported in the emulator.

Final thoughts

So, basically, I see two problems:

  • why is the service account key required for the emulator?
  • why is the data not imported even with a service account key?
@cuong0993
Copy link

Forked here https://github.com/cuong0993/node-firestore-import-export

Pass GOOGLE_CLOUD_PROJECT and FIRESTORE_EMULATOR_HOST to connect with emulator.
For example,

GOOGLE_CLOUD_PROJECT=demo- FIRESTORE_EMULATOR_HOST=localhost:8089 firestore-import --backupFile db.json --yes

@nojaf
Copy link

nojaf commented Sep 16, 2023

@cuong0993 I just tried this and it worked like a charm.
Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants