kossnocorp / typesaurus

🦕 Type-safe TypeScript-first ODM for Firestore
https://typesaurus.com
415 stars 36 forks source link

next.js client component: firebase-admin being loaded #125

Open TomKaltz opened 9 months ago

TomKaltz commented 9 months ago

When a client component is pre-rendered on the server Typesaurus will try to load firebase-admin and throw an error 'The default Firebase app does not exist'. How do we prevent this?

kossnocorp commented 8 months ago

Hey, @TomKaltz, thank you for reporting that, and sorry for the silence. I was on vacation. I will investigate and share a solution or publish an update that fixes it.

kevinpiac commented 3 months ago

Hey!

Any updates on this? If anyone has a good idea on how to fix it I could write a PR :)

otajor commented 1 month ago

We're also running into this issue when trying to run jest tests on our frontend firebase code with typesaurus. Typesaurus seems to think it is on the server and I don't know how to get it to use the web adaptor. Jest's testEnvironment is jsdom so it should act mostly like a DOM environment.