firebase / firebase/extensions

🐛 [fs-bq-import-collection] replaces Firestore database ID with (default) in document_name when importing to BigQuery

Open
#2,563 3 comments 0 reactions 1 assignee Claimed by @cabljac View on GitHub
reproduced type: bug
Dominant language
TypeScript
Stars
979
Forks
433
Avg merge
1d 13h
Merged PRs (30d)
125

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](http://stackoverflow.com/)
with the firebase tag.
- For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/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](https://firebase.google.com/support/troubleshooter/contact/) directly.

### [REQUIRED] Step 2: Describe your configuration

- Extension name: **\_** fs-bq-import-collection
- Extension version: **\_** 0.1.27
- Configuration values:
--project=my-project-001
--big-query-project=my-project-001
--source-collection-path=my_collection
--query-collection-group=false
--dataset=my_bq_database
--dataset-location=europe-west1
--table-name-prefix=my_collection
--firestore-instance-id=my-firestore-database

### [REQUIRED] Step 3: Describe the problem

#### Steps to reproduce:

When importing from a non-default Firestore database, the document_name stored in BigQuery uses databases/(default) instead of the provided non-default database ID.

How to reproduce:

In a project with multiple Firestore databases, ensure there is a non-default database (e.g., my-firestore-database) and that it contains documents in the my_collection collection.
```
Run: npx @firebaseextensions/fs-bq-import-collection
--non-interactive
--project=my-project-001
--big-query-project=my-project-001
--source-collection-path=my_collection
--query-collection-group=false
--dataset=my_bq_database
--dataset-location=europe-west1
--table-name-prefix=my_collection
--firestore-instance-id=my-firestore-database
```
Inspect the imported rows in BigQuery (dataset my_bq_database). The document_name field shows the database segment as (default) instead of the specified my-firestore-database.
Example:

Expected document_name: projects/my-project-001/databases/my-firestore-database/documents/my_collection/00778889
Actual document_name: projects/my-project-001/databases/(default)/documents/my_collection/00778889

##### Expected result

document_name should include the targeted non-default Firestore database ID provided via --firestore-instance-id: projects/my-project-001/databases/my-firestore-database/documents/my_collection/00778889

##### Actual result

document_name contains (default), ignoring the provided non-default database ID: projects/my-project-001/databases/(default)/documents/my_collection/00778889

Here is an image comparing the result of the script (operation=import) and the result of an automatic update from the extension https://extensions.dev/extensions/firebase/firestore-bigquery-export. As you can see in cyan, it’s my actual collection name; in the import one, it shows (default).

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.