Support for the modular Firebase 9 #3956
Replies: 23 comments
-
I don't oppose it, but since the adapter is server-side only, it won't really have a big effect in my opinion. Or is there any other reason for version 9 to be better than modularity? |
Beta Was this translation helpful? Give feedback.
-
The main shtick of v9 is the reduced bundle size on the both client/server side. This is what they say
|
Beta Was this translation helpful? Give feedback.
-
v9 is gonna be a refactor I suppose. Things like: async createUser(profile) {
const userRef = await client.collection("users").add(newUser)
const snapshot = await userRef.get()
const user = docSnapshotToObject(snapshot)
return user
} is going to be import { collection, doc, addDoc } from "firebase/firestore";
async createUser(profile) {
const userRef = await addDoc(collection("users", newUser));
const snapshot = await getDoc(userRef)
const user = docSnapshotToObject(snapshot)
return user
} |
Beta Was this translation helpful? Give feedback.
-
would like to land #2361 first, but yeah. it will need a refractor. |
Beta Was this translation helpful? Give feedback.
-
@atanaskanchev, @wobsoriano the refactored version is available at nextauthjs/adapters#183. I would appreciate it if you could look and help to think through how we could utilize Firebase 9. My biggest question is how to provide all the necessary methods because I would like to keep the adapter APIs for different adapters similar. Meaning most adapters pass a Taking the above example by @wobsoriano for // [...nextauth].js
import { FirebaseAdapter } from "@next-auth/firebase-adapter"
import { collection, doc, addDoc } from "firebase/firestore"
const firebaseClient = { collection, doc, addDoc } // Add any necessary methods here
export default NextAuth({
...
adapter: FirebaseAdapter(firebaseClient)
}) |
Beta Was this translation helpful? Give feedback.
-
Oh wait... looks like web only has the modular update. Not sure |
Beta Was this translation helpful? Give feedback.
-
So it might not be necessary to upgrade after all? 😁 We are using the package simply called |
Beta Was this translation helpful? Give feedback.
-
Just tried So yeah, your example will do 😁 import { FirebaseAdapter } from '@next-auth/firebase-adapter'
import { initializeApp } from 'firebase/app'
import {
getFirestore,
collection,
query,
getDocs,
where,
limit,
doc,
getDoc,
addDoc,
updateDoc,
deleteDoc
} from 'firebase/firestore'
const firebaseApp = initializeApp({ /* config */ });
const db = getFirestore(firebaseApp)
const firebaseClient = {
db,
collection,
query,
getDocs,
where,
limit,
doc,
getDoc,
addDoc,
updateDoc,
deleteDoc
}
export default NextAuth({
adapter: FirebaseAdapter(firebaseClient)
}) // somewhere
async createUser(profile) {
const userRef = await addDoc(collection(db, 'users'), newUser);
const snapshot = await getDoc(userRef)
const user = docSnapshotToObject(snapshot)
return user
} |
Beta Was this translation helpful? Give feedback.
-
Thanks, I will have a look then! The question is, are people ready for Firebase 9 yet, or should we publish the next version with 8, and when 9 gets to stable, we refactor then? I don't want to maintain 2 different versions of the adapter. |
Beta Was this translation helpful? Give feedback.
-
@atanaskanchev, @wobsoriano I did the rewrite, |
Beta Was this translation helpful? Give feedback.
-
@balazsorban44 I am facing some issues while using firebase 9, what I passed into the firebase adapter function is the instance of firestore returned by geFirestore() |
Beta Was this translation helpful? Give feedback.
-
Will there be a new official update to the Firebase Adapter Docs? |
Beta Was this translation helpful? Give feedback.
-
Still haven't decided. See nextauthjs/adapters#183 What's the status of Firebase 9? Is it stable yet? |
Beta Was this translation helpful? Give feedback.
-
I'm getting |
Beta Was this translation helpful? Give feedback.
-
Yes Firebase is stable. It's version ^9.4.1
|
Beta Was this translation helpful? Give feedback.
-
We should go for v9 then I think. I'm not able to work on the PR, so if anyone is interested in picking up, please do 🙏. Would be awesome to figure out if we can integrate with Firebase Auth as well. |
Beta Was this translation helpful? Give feedback.
-
Please add support for v9 as soon as possible. It's a humble request. |
Beta Was this translation helpful? Give feedback.
-
"as soon as possible" is not really humble. 😕 Please read #3827. Feel free to work on it. Useful links: https://next-auth.js.org/adapters/overview See other adapters for example on testing, TypeScript etc.: |
Beta Was this translation helpful? Give feedback.
-
I am not good with words. I am sorry if that was rude in any way. It's just I am stuck on a project where I am using Firebase v9. It's my first time using any adapter, I don't even know what an adapter is properly, I was just following a tutorial. But I will definitely try to work on it, whatever I can. |
Beta Was this translation helpful? Give feedback.
-
No hard feelings! 💚 Hopefully, the above links should give you a proper introduction. When you've read through all of them and still have questions, don't hesitate to ask. |
Beta Was this translation helpful? Give feedback.
-
Please see https://github.com/nextauthjs/adapters/issues/180#issuecomment-1004126562 with regards to firebase auth. The issue seems to be closed. I have also got it in a basic working state here nextauthjs/adapters#363 |
Beta Was this translation helpful? Give feedback.
-
React-Query-Firebase is pretty much working like a firebase adapter right now @srijans38 @SahilAujla |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The modular Firebase v9 is in the final beta stages and it's quite stable. I am looking forward to adding support for it to the Firebase adapter.
Beta Was this translation helpful? Give feedback.
All reactions