0

I cannot read or write to the firebase real-time database... please help.

I have set my rules to both read and write 'true', and I've tested it in the playground. I'm using the create-react-app boilerplate setup. My version of the firebase is 9.6.4

Here's my firebase file

import { initializeApp } from 'firebase/app';
import { getDatabase, set, ref } from 'firebase/database';

const firebaseConfig = {
    apiKey: 'AIzamGZ1LBAAtb',
    authDomain: 'helpme.firebaseapp.com',
    databaseURL: 'https://helpme.firebaseio.com',
    projectId: 'helpme',
    storageBucket: 'helpme.appt.com',
    messagingSenderId: '93help1',
    appId: '1:293268271119:web:d4e9e73help',
    measurementId: 'helpKQLWS',
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getDatabase(app);

set(ref(db, 'chatroom'), {
    name: '',
    createdAt: '',
    photo: '',
});
Caramel Ify
  • 25
  • 1
  • 1
  • 6
  • I hope these aren’t your real credentials… Please change your firebase credentials for security’s sake and don’t EVER post your credentials on the internet. Otherwise any fool could acces your database – Casper Kuethe Jan 22 '22 at 22:41
  • They're not any real data. – Caramel Ify Jan 22 '22 at 22:58
  • @CasperKuethe While I agree that it's not necessary to post the app configuration on Stack Overflow, please note that the information in `firebaseConfig` are configuration data and **not** credentials. See my answer here for a longer explanation: https://stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public/37484053#37484053 – Frank van Puffelen Jan 22 '22 at 23:29
  • Better safe than sorry ‍♂️ – Casper Kuethe Jan 23 '22 at 20:12

0 Answers0