🐛 [fs-bq-import-collection] Documents Aren't Passing Between Projects #2055
Description
[READ] Step 1: Are you in the right place?
Issues filed here should be about bugs for a specific extension in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:
- For general technical questions, post a question on StackOverflow
with the firebase tag. - For general Firebase discussion, use the firebase-talk
google group. - To file a bug against the Firebase Extensions platform, or for an issue affecting multiple extensions, please reach out to
Firebase support directly.
[REQUIRED] Step 2: Describe your configuration
- Extension name: fs-bq-import-collection
- Extension version: 0.1.21
- Configuration values (redact info where appropriate): The CLI command was (either of the following):
- npx @firebaseextensions/fs-bq-import-collection --non-interactive --project=projectA* --source-collection-path=event-data --query-collection-group=true --use-new-snapshot-query-syntax=true --big-query-project=projectB* --dataset=event_data --table-name-prefix=ed --dataset-location=eu --multithreaded
- npx @firebaseextensions/fs-bq-import-collection --non-interactive -P projectA* -B projectB* -q true -s event-data -d event_data -t ed -l eu -m true -u true
*redacted specific project names
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
- Set up projectA and populate firestore collection group event-data
- Set up projectB but do not populate firestore
- Run the command above
What happened? How can we make the problem occur?
The program failed with an error - I didn't screenshot the error but it was related to line 26 in worker.js, specifically that docs[0].id
was undefined.
I added some additional logging to worker.js and found that while the CLI config was being parsed correctly, the instance of firebase that was initialised was that of projectB not projectA. The error that occurred was that the collection-group-query was searching projectB's firestore, and was not finding any documents so docs[0].id was indeed null/undefined.
I tried running the command while in a directory that didn't have an instance of firebase.json and found the same issue.
You can reproduce these steps by logging the config that is passed into the function in line 7 of worker.js and logging the query object before line 25 to see that the query is happening to the wrong project.
Expected result
The expected result would be that a table would be created in bigquery in projectB, and is filled with the data from the collection group 'event-data' from firestore in projectA
Actual result
The CLI crashed due to attempting to retrieve documents from the wrong project.
Activity