You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[firestore-bigquery-change-tracker] initializeLatestView update path mutates the shared RawChangelogViewSchema constant #3144
Package: @firebaseextensions/firestore-bigquery-change-tracker, src/bigquery/initializeLatestView.ts on next.
The existing-view path aliases the module-level constant and mutates it:
constschema=RawChangelogViewSchema;// line 77
...
if(config.wildcardIds){schema.fields.push(documentPathParams);// line 86}
The create path copies first (const schema = { fields: [...RawChangelogViewSchema.fields] }, line 124), so only the update path leaks. Each initializeLatestView call in the same process with wildcardIds set appends another path_params field to the shared constant. Later readers of RawChangelogViewSchema in the same process see the duplicates, including view.setMetadata({ schema: RawChangelogViewSchema }) on line 144 of the create path.
In a long-lived function instance that initialises more than once (several trackers, or the initBigQuerySync task followed by the trigger) the schema sent to BigQuery grows by one duplicate path_params per init. BigQuery rejects duplicate column names in a schema update, so after the first re-init the update path fails until the instance is recycled.
Fix: copy on the update path the same way the create path does.
Activity
fix: give each tenant a clean view schema when initializing