Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native Unhandled Promise Using Database instead of Firestore #1174

Open
brhoomjs opened this issue Mar 10, 2022 · 1 comment
Open

React Native Unhandled Promise Using Database instead of Firestore #1174

brhoomjs opened this issue Mar 10, 2022 · 1 comment

Comments

@brhoomjs
Copy link

Do you want to request a feature or report a bug?
bug

(If this is a usage question, please do not post it here—post it on gitter. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)

What is the current behavior?
After sign in with RNFirebase I got this error:

Possible Unhandled Promise Rejection (id: 0):
Error: You attempted to use 'firebase.database' but this module could not be found.

Ensure you have installed and imported the '@react-native-firebase/database' package.
firebaseRootModuleProxy@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true...etc

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

import RNFirebase from "@react-native-firebase/app";
import "@react-native-firebase/auth";
import "@react-native-firebase/firestore";

import {
  firebaseReducer,
  ReactReduxFirebaseProviderProps,
  ReactReduxFirebaseConfig,
  getFirebase,
} from "react-redux-firebase";
import {
  createFirestoreInstance,
  firestoreReducer,
  getFirestore,
} from "redux-firestore";
import ReduxThunk from "redux-thunk";

RNFirebase.auth().languageCode = "en";
RNFirebase.auth().settings.appVerificationDisabledForTesting = true;

const rrfConfig: ReactReduxFirebaseConfig = {
  userProfile: COLLECTIONS.USERS,
  useFirestoreForProfile: true,
  useFirestoreForStorageMeta: true,
  attachAuthIsReady: true,
  autoPopulateProfile: false,
  dispatchOnUnsetListener: false,
  dispatchRemoveAction: false,
  enableEmptyAuthChanges: false,
  enableLogging: false,
  enableRedirectHandling: false,
  firebaseStateName: "",
  logErrors: false,
  presence: false,
  preserveOnEmptyAuthChange: undefined,
  preserveOnLogout: undefined,
  resetBeforeLogin: false,
  setProfilePopulateResults: false,
  updateProfileOnLogin: false,
  onAuthStateChanged: function (
    user: any,
    _firebase: any,
    dispatch: Dispatch<AnyAction>
  ): void {
    // throw new Error("Function not implemented.");r
  },
  sessions: "",
};

const rootReducer = combineReducers({
  firebase: firebaseReducer,
  firestore: firestoreReducer,
});


const initialState = {};
const middlewares = [
  ReduxThunk.withExtraArgument({ getFirebase, getFirestore }),
];
export const store = createStore(
  rootReducer,
  initialState,
  compose(applyMiddleware(...middlewares))
);
export const rrfProps: ReactReduxFirebaseProviderProps = {
  firebase: RNFirebase,
  config: rrfConfig,
  dispatch: store.dispatch,
  createFirestoreInstance,
};
export { AppState } from "./reducers";

What is the expected behavior?
I expect to save sync user with Firestore instead of database. I read the documents carefully but I think it is outdated.
BTW I really appreciate your awesome work for this repo.

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

{
    "react-redux-firebase": "^3.11.0",
    "redux": "^4.1.2",
    "redux-firestore": "^1.0.0",
    "redux-thunk": "^2.4.1"
}
@csumrell
Copy link

I am getting this same error as well trying to follow documentation on fresh setup to use firestore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants