[Community] useFirestoreDelegate Firebase not initialised
Hey there, I wanted to add a basic user verification without using claims, but I am getting Firebase not initialised error.
This is my code:
const myAuthenticator: Authenticator<FirebaseUserWrapper> = useCallback(
async ({ user, authController }) => {
const idTokenResult = await user?.firebaseUser?.getIdTokenResult();
const userIsAdmin = idTokenResult?.claims.admin;
console.log("Allowing access to", user);
const adminUser = await firestoreDelegate.fetchEntity({path:"cms/config/users", entityId:(user?.email ?? "")});
return adminUser !== undefined;
},
[]
);
The issue is, the app works when I deploy it locally, but does not work when I deploy it to firebase hosting. What am I doing wrong?
Hi @LukasAnda could you post the full error stacktrace?
Sure: Here is what I see in the console:
| Mn | @ | index.es.js:4402
-- | -- | -- | --
| kA | @ | react-dom.production.min.js:160
| PV | @ | react-dom.production.min.js:289
| kV | @ | react-dom.production.min.js:279
| Ple | @ | react-dom.production.min.js:279
| dw | @ | react-dom.production.min.js:279
| wV | @ | react-dom.production.min.js:267
| M | @ | scheduler.production.min.js:13
| I | @ | scheduler.production.min.js:14
Hi @LukasAnda , is still an issue or it has been solved?
If it's still unsolved, can you try to reference the full stack-trace of the error that you mentioned? Firebase not initialised error.
That should give us some clues.
This has been resolved ^_^