Skip to content

firebase.updateProfile throws error when using firestore to store profile #932

Open
@chrislewispac

Description

@chrislewispac

I have used the example from the docs...

import React from "react";
import { useSelector } from "react-redux";
import { useFirebase } from "react-redux-firebase";

export default function Title(props) {
  const firebase = useFirebase();
  const profile = useSelector((state) => state.firebase.profile);

  console.log(profile);

  function updateUserProfile() {
    return firebase.updateProfile({ role: "admin" });
  }

  return (
    <React.Fragment>
      <h2>Update User Profile</h2>
      <button onClick={updateUserProfile}>Add Role To User</button>
    </React.Fragment>
  );
}

When I use the following configs:

const rrfConfig = {
  userProfile: "users",
  useFirestoreForProfile: true, // Firestore for Profile instead of Realtime DB/
  enableClaims: true, // Get custom claims along with the profile
  presence: "presence", // where list of online users is stored in database
  sessions: "sessions", // where list of user sessions is stored in database (presence must be enabled)
};

I get the following error:


firebaseNamespaceCore.ts:227 Uncaught TypeError: Cannot read property '_getService' of undefined

-----------------

 224 | // option added to the no-explicit-any rule when ESlint releases it.
  225 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
  226 | function(...args: any) {
> 227 |   const serviceFxn = this._getService.bind(this, componentName);
      | ^  228 |   return serviceFxn.apply(
  229 |     this,
  230 |     component.multipleInstances ? args : []

If I use the following configs:

// react-redux-firebase config
const rrfConfig = {
  userProfile: "users",
  enableClaims: true, // Get custom claims along with the profile
  presence: "presence", // where list of online users is stored in database
  sessions: "sessions", // where list of user sessions is stored in database (presence must be enabled)
};

It performs as expected.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions