firebase / extensions

Source code for official Firebase extensions
https://firebase.google.com/products/extensions
Apache License 2.0
882 stars 373 forks source link

🐛 [fs-bq-import-collection] Documents Aren't Passing Between Projects #2055

Open joeframpton opened 2 months ago

joeframpton commented 2 months ago

[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:

[REQUIRED] Step 2: Describe your configuration

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

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.