Firebase library behaves differently in expo

Recently I found out strange things in using firebase in expo.
I recently changed by database from real-time database to firestore.
First, I felt it was working fine when I developed on ios. However, it did not work in android, therefore I had to look into issue to solve this problem. However, I didn’t have to do anything in react-native init project. Felt really wierd for me.

Also, there was another issue which was in firestore rules. It worked fine in normal react-native init project either. However, in expo, it didn’t work. It always threw the error when trying to use the firestore security rules. The rules I set was just simple one in the example.

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read: if request.auth != null;
    }
  }
}

If I get rid of if request.auth != null and but if true instead. It just works fine…
Same code in react-native init project worked fine. I searched on the google and found some same issue.

My question is, why is this happening in expo project and not in react-native init project? I thought it was firebase issue but don’t understand why it is not working properly in expo.

1 Like

I think you have to roll back your firebase version to 4.6.2. I am going to test this and get back to you.

Hi @dooboolab! While @clarktank looks into this, I’l allso link this github issue here in case it’s the cause of your problem: https://github.com/expo/expo/issues/1562

1 Like

@schazers Oh! so you mean it will be working fine in sdk 26?

James has summarized the current status on that github issue: “We think we can include this with SDK 26. We don’t have an ETA or roadmap for SDK 26 yet, and will include notes about the update on blog.expo.io.” Sorry - we don’t know more than that for sure yet, but we’ll try our best!

@dooboolab Rolling back to 4.6.2 doesn’t work for me. I guess we have to wait for SDK 26.

1 Like

Yes. I’ve already tried this. Thank you for reminding tough.
I am waiting for sdk 26.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.