Firebase integration
Wanted to make this thread to point a few things for future devs looking to use firebase with the recommended data provider from https://github.com/resulturan/refine-firebase
This repo is a little outdated and made for refine 3.x so to use it in 4.x you wither use legacyAuthProvider instead of the normal authProvider or fork the repo and make your own changes according to https://refine.dev/docs/migration-guide/auth-provider/#motivation-behind-the-changes which is the path i took.
Regarding firestore the basic getList, getOne etc. seem to be working but there are a lot of bugs if you want to use custom logic. These bugs come from trying to use the firestore module along with refine-firebase which don't seem to want to communicate ( trying to access database from refine-firebase and using custom functions).
What i ended up doing was importing any functions i needed like getCountFromServer or the aggregations form recent versions of firestore in the fork of refine-firebase and used it from there. My version of refine-firebase is @armable/refine-firebase using firestore 10.8.0.
Hope this saves other people some time at least in finding out what the error messages you keep getting are.
GitHub
GitHub - resulturan/refine-firebase
Contribute to resulturan/refine-firebase development by creating an account on GitHub.
Migrating Auth Provider from 3.x.x to 4.x.x | Refine
Motivation behind the changes
3 Replies
Hi @Emi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Thank you for sharing your experience and solution for integrating Firebase with Refine using the
refine-firebase
data provider. Your insights will indeed be helpful for other developers facing similar issues.
As you've pointed out, the refine-firebase
package might be outdated and not fully compatible with the latest version of Refine. It's great that you've managed to fork the repo and make necessary changes to make it work with Refine 4.x.
For those who might face similar issues, it's important to note that Refine's open-source community has created various data providers, including one for Firebase (refine-firebase
(https://www.npmjs.com/package/refine-firebase)) as mentioned in the Community Data Providers (https://refine.dev/docs/data/packages/community-data-providers) documentation. However, if you're having troubles with these data providers, it's recommended to contact the maintainers of the data provider first.
For more complex or custom logic, you might need to extend or modify the data provider to suit your needs. Refine provides a guide on how to swizzle a data provider (https://refine.dev/docs/tutorial/understanding-dataprovider/swizzle/) to fit your backend.
Also, Refine provides a Live Provider (https://refine.dev/docs/realtime/live-provider/) for handling realtime data operations, which could be useful when working with Firebase's realtime updates.
Remember to check the official documentation (https://refine.dev/docs/) for more information on how to use Refine and its various features.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@268705889865695234> kapa.ai is still learning and improving, please let us know how it did by reacting below
apparent-cyan•7mo ago
Hello @Emi , greatly appreciate your efforts and contributing to the community with your know-how!
You can also consider creating a PR to
https://github.com/resulturan/refine-firebase
repository, or create a new package that is compatible with refine v4, we'd be more than happy to add your package to our documentation.