cant access realtime database of firebase in react native

Viewed 26

I had initialized the Firebase in my project through downloading the google-services.JSON file after initializing the realtime database. console.log(database.ref) returns the correct link for the database but for some reason I am not able to read to write data into the database

one thing I noticed is that

try {
  await database().ref('users/123').set({
    name: '5',
    age: 31,
  });
  console.log('done?');
} catch (error) {
  console.log('error', error);
} finally {
  console.log('error?');
}

the finally block is not getting executed for some reason..

In terms of reading the database it was working fine at some point but now that do doesn't seem to execute. This happened when I tried to fix the write issue by adding the

implementation platform('com.google.firebase:firebase-bom:30.2.0')

and dependencies in the build.gradle file inside app folder of android. I tried rolling back the changes but still no luck.

Don't know how I was able to read before this and its really frustrating

update: Here the snapshot is updated and its not reflected in the database when I check the firebase console

database().ref('users').set('uid');
database()
.ref('users')
.on('value', snapshot => {
    console.log('User data: ', snapshot.val());
                });

and when I put an await before the set

await database().ref('users').set('uid');

it seems to be stuck on that line and the rest of the code is not executed. I'm not shown any errors.

Also i am not able to read data from database too for some reason

Could some explain whats happening and what I could do about it?

Could anyone help me with this?

0 Answers
Related