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

Cannot backfill raw table because of error "Cannot read property 'forEach' of undefined" #1309

Closed
XaviePaez opened this issue Nov 22, 2022 · 6 comments
Labels
extension: firestore-bigquery-export Related to firestore-bigquery-export extension type: bug Something isn't working

Comments

@XaviePaez
Copy link

[REQUIRED] Step 2: Describe your configuration

  • Extension name: firestore-bigquery-export
  • Extension version: 0.1.27

[REQUIRED] Step 3: Describe the problem

Running the @firebaseextensions/fs-bq-import-collection import scripts leads to an inserting error while trying to backfill a specific collection.

This error occurs only for one collection and for the project labelled "prod", the others have not faced this issue. Indeed, we have 2 projects implemented to validate "Staging" and "PROD" environments and this error is only appearing on the PROD project for this specific collection and no data is uploaded during the import scripting (except the one from the Stream Collection to BigQuery plugged).

Steps to reproduce:

  • Run the @firebaseextensions/fs-bq-import-collection.

Logs Staging :

Importing data from Cloud Firestore Collection: rewards, to BigQuery Dataset: project_staging_firestore_export, Table: rewards_raw_changelog
{"severity":"INFO","message":"BigQuery dataset already exists: project_staging_firestore_export"}
{"severity":"INFO","message":"BigQuery table with name rewards_raw_changelog already exists in dataset project_staging_firestore_export!"}
{"severity":"INFO","message":"Clustering removed on rewards_raw_changelog"}
{"severity":"WARNING","message":"No valid table reference is available. Skipping partitioning"}
{"severity":"WARNING","message":"Cannot partition an existing table project_staging_firestore_export_rewards_raw_changelog"}
{"severity":"INFO","message":"View with id rewards_raw_latest already exists in dataset project_staging_firestore_export."}
{"severity":"INFO","message":"Updated 'rewards_raw_latest' table with a 'document_id' column"}
{"severity":"INFO","message":"Inserting 153 row(s) of data into BigQuery"}
{"severity":"INFO","message":"Inserted 153 row(s) of data into BigQuery"}
---------------------------------------------------------
Finished importing 153 Firestore rows to BigQuery
---------------------------------------------------------

Logs PROD :

Importing data from Cloud Firestore Collection: rewards, to BigQuery Dataset: project_prod_firestore_export, Table: rewards_raw_changelog
{"severity":"INFO","message":"BigQuery dataset already exists: project_prod_firestore_export"}
{"severity":"INFO","message":"BigQuery table with name rewards_raw_changelog already exists in dataset project_prod_firestore_export!"}
{"severity":"INFO","message":"Clustering removed on rewards_raw_changelog"}
{"severity":"WARNING","message":"No valid table reference is available. Skipping partitioning"}
{"severity":"WARNING","message":"Cannot partition an existing table project_prod_firestore_export_rewards_raw_changelog"}
{"severity":"INFO","message":"View with id rewards_raw_latest already exists in dataset project_prod_firestore_export."}
{"severity":"INFO","message":"Updated 'rewards_raw_latest' table with a 'document_id' column"}
{"severity":"INFO","message":"Inserting 22090 row(s) of data into BigQuery"}
{"severity":"INFO","message":"Retried to insert 22090 row(s) of data into BigQuery (ignoring unknown columns)"}
{"severity":"INFO","message":"Inserting 22090 row(s) of data into BigQuery"}
{"severity":"WARNING","message":"Error when inserting data to table."}
Error importing Collection to BigQuery: TypeError: Cannot read property 'forEach' of undefined
Expected result

Same result than Staging environment

Actual result
{"severity":"WARNING","message":"Error when inserting data to table."}
Error importing Collection to BigQuery: TypeError: Cannot read property 'forEach' of undefined
@cabljac cabljac added this to Under consideration in Extension Update Tracker via automation Nov 22, 2022
@cabljac
Copy link
Contributor

cabljac commented Nov 22, 2022

potentially related/fixed by #1292

@cabljac cabljac added extension: firestore-bigquery-export Related to firestore-bigquery-export extension type: bug Something isn't working labels Nov 22, 2022
@XaviePaez
Copy link
Author

Hello @cabljac ,

Thank you for your quick comment.

Do you know what could be the origin of the issue ? And when this would be fixed ?

Thank you in advance for your help.

@cabljac
Copy link
Contributor

cabljac commented Nov 23, 2022

Screenshot 2022-11-23 at 11 23 07

I believe it's this line, parsed.errors is not defined in this case. Seems to be different to the above fix actually

@XaviePaez
Copy link
Author

Thank you @cabljac.
Do I have to modify something ? or a git pull will solve the issue ?

@cabljac
Copy link
Contributor

cabljac commented Nov 24, 2022

I've opened a PR to fix this issue, so it should be fixed in the next release. In the mean time if it's urgent you could patch your version, essentially i think we need optional chaining on line 253:

parsed.errors?.forEach((e) => console.error(....

@dackers86
Copy link
Member

Closing as issue resolved in #1310 and released in version 0.1.29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension: firestore-bigquery-export Related to firestore-bigquery-export extension type: bug Something isn't working
Projects
Development

No branches or pull requests

3 participants