Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Configure Firestore Settings throws error #38

Open
MNorgren opened this issue Jun 3, 2021 · 2 comments
Open

Configure Firestore Settings throws error #38

MNorgren opened this issue Jun 3, 2021 · 2 comments

Comments

@MNorgren
Copy link

MNorgren commented Jun 3, 2021

I want to configure my firestore settings for a specific migration. I need to set "ignoreUndefinedProperties: true". When I do this within the migrate function, I receive an error that Firestore has already been initialized. Is there a way to configure firestore settings?

export async function migrate({firestore} : MigrateOptions) {
  firestore.settings({ timestampsInSnapshots: true, ignoreUndefinedProperties: true });
  ...
}
@MNorgren
Copy link
Author

If anyone else is needing to do something similiar, I was able to work around this config issue with the following HACK:

// HACK: Changing ignored undefined properties
const tempFireStore = firestore as any;
tempFireStore._settingsFrozen = false;
tempFireStore.settings({ignoreUndefinedProperties: true});
tempFireStore._settingsFrozen = true;

@hellovai
Copy link

Thanks! The workaround for me now as well :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants