Reputation: 33
Each time I set rules in firebase database console (in the web-page) it resets. Maybe its something I don't get about firebase and saving but I have to set new rules each time I visit the page. I get the "Get Started" page when I go there and I am starting to think that its something I don't get about it. Anyone that can explain what I am not understanding? I have tried to see if things get saved to the database and get an error message:
"undefined is not an object (evaluating '_firebase.firebase.auth')"
. Maybe thats a separate problem but it could be linked to the above problem. Confused...
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import firebase from 'firebase';
import ReduxThunk from 'redux-thunk';
import reducers from './reducers';
import LoginForm from './components/LoginForm';
import Router from './Router';
class App extends Component {
componentWillMount() {
const config = {
apiKey: 'code',
authDomain: 'domain',
databaseURL: 'url',
projectId: 'id',
storageBucket: 'another url',
messagingSenderId: 'msgid'
};
firebase.initializeApp(config);
}
render() {
const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
return (
<Provider store={store}>
<Router />
</Provider>
);
}
}
export default App;
Upvotes: 2
Views: 475
Reputation: 83058
It is difficult to be 100% sure what is your problem but you are probably overwriting, upon project deployment, the security rules that you defined in the Firebase console with the ones that are in your local Firebase project.
When you initialise a Firebase project via the CLI (https://firebase.google.com/docs/cli/#initializing_a_project_directory) the CLI creates by default a file which contains the database rules (named database.rules.json
).
When you deploy your project via the firebase deploy
command (without the --only
flag), the CLI overwrites the security rules stored in the Firebase online console with the ones you have in this json file.
In order to prevent this behaviour, you can suppress this file in your local project.
Upvotes: 2