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

[Firestore] Version 12, issue with queries and withConverter() #2437

Open
Daavidaviid opened this issue Jan 30, 2024 · 3 comments
Open

[Firestore] Version 12, issue with queries and withConverter() #2437

Daavidaviid opened this issue Jan 30, 2024 · 3 comments

Comments

@Daavidaviid
Copy link

Daavidaviid commented Jan 30, 2024

We expect to get a snapshot with the right type, but instead, we get unknown.

Downgrading to 11.11.0 fixes the issue

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@AnderzL7
Copy link

+1

@jfbloom22
Copy link

I have been following this pattern:

// converter from https://stackoverflow.com/questions/74456704/how-to-type-usefirestore-using-typescript-interfaces
export const firebaseConverter = <T>() => ({
  toFirestore: (data: PartialWithFieldValue<T>) => data,
  fromFirestore: (snap: QueryDocumentSnapshot) => snap.data() as T,
});

  const userDocQuery = admin.firestore().collection('users').doc(userId).withConverter(firebaseConverter<User>());

But this does not work with Version 12.

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

No branches or pull requests

4 participants