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

Android firestore:24.0.1 has bug preventing reconnection to firestore after being backgrounded (workaround: use bom 29.2.1) #6158

Closed
evelant opened this issue Mar 26, 2022 · 7 comments · Fixed by #6122 or #6238

Comments

@evelant
Copy link

evelant commented Mar 26, 2022

Per the title the Android firebase-firestore SDK v24.0.1 has a bug that will cause it to fail to reconnect to firestore after an app has been backgrounded and come back to the foreground.

This is actually a bug in grpc-java that was fixed in v1.44.1 https://github.com/grpc/grpc-java/releases/tag/v1.44.1

firebase-firestore did not upgrade to grpc-java 1.44.1 until version firebase-firestore:24.0.2 but the current version of react-native-firebase uses firebase-firestore:24.0.1 which still has the bug

firebase/firebase-android-sdk#3302

I resolved this locally by overriding the firebase sdk version on Android so that 24.0.2 is used like so in build.gradle

ext {
    set('react-native', [
                versions: [
                  // Overriding Library SDK Versions
                  firebase: [
                    // Override Firebase SDK Version
                    bom           : "29.2.1"
                  ]
                ],
              ])
}
@mikehardy
Copy link
Collaborator

Sure - working to unblock this via #6122 but it's stuck on an issue with auth emulator. We do allow overrides though luckily
I'll leave this open but alter the title a bit in case others need it

@mikehardy mikehardy changed the title Android firebase-firestore:24.0.1 has severe bug preventing reconnection to firestore after an app has been backgrounded Android firestore:24.0.1 has bug preventing reconnection to firestore after being backgrounded (workaround: use bom 29.2.1) Mar 26, 2022
@stale
Copy link

stale bot commented Apr 28, 2022

Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Apr 28, 2022
@mikehardy
Copy link
Collaborator

The firebase-android-sdk did not do a v29 release that includes the fix for the emulator I needed, it will be included in v30 firebase-android-sdk and I have the work for that port started. In the meantime affected users will need to specify the bom version as indicated here.

@evelant
Copy link
Author

evelant commented May 10, 2022

@mikehardy reading over the issues with upgrading firebase SDKs, particularly firebase/firebase-android-sdk#3557 I've realized that using bom 29.2.1 is working in production to prevent this issue but is plaguing me in development where any given reload of the app seems to have a random chance of losing connection to the auth emulator. Based on that issue it looks like the firebase sdks still don't have a fix for the auth emulator issue so I'm not sure that recommending specifying 29.2.1 is so much a fix for this issue as it is a tradeoff that resolves the reconnect issue but introduces the auth emulator issue. Are there any firebase sdk versions that currently have neither problem that you might recommend trying?

@mikehardy
Copy link
Collaborator

@evelant indeed, it is fraught and I'm uncomfortable with the current state but there is no trivial solution that gets you up to date firestore and working auth emulator.

The best I can recommend if you need auth emulator and you want a firestore dependency that does not have this issue is the more up to date firestore dependency specifically, along with the older BoM (29.2.0).

The path I would take is patch-package, and a modification of this exact line here:

implementation "com.google.firebase:firebase-firestore"

To be a specific version that is ahead of the BoM but still works. I think 24.1.1 works. If you can confirm it works, given I'm stuck on updating the SDK BOM I might do a patch release that just has this workaround:

  implementation "com.google.firebase:firebase-firestore:24.1.1"

@mikehardy mikehardy reopened this May 10, 2022
@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label May 10, 2022
@mikehardy
Copy link
Collaborator

Re-opening as I was sure based on interaction with firebase-android-sdk team this would be fixed and I'd do a release today with new SDKs, but that was not to be and this issue may be actionable based on test results from the above

@mikehardy
Copy link
Collaborator

I've got PR #6238 up that does what I mentioned and I'm going to release that to relieve the pressure on the auth emulator situation by getting at least a newer firestore out. There appears to be progress on the auth emulator issue but I really don't like cross-issue dependencies :-). 14.9.3 here (when it is out, a bit later today) will have the up to date firestore while still having an auth from bom 29.2.0 so it works locally

mikehardy added a commit that referenced this issue May 10, 2022
mikehardy added a commit that referenced this issue May 13, 2022
the upstream breaking change was removal of analytics ecommerce constants,
those are already gone here

the features added are not exposed here yet,  so to us this is just a fix release

allows reversal of workaround in #6158
mikehardy added a commit that referenced this issue May 14, 2022
the upstream breaking change was removal of analytics ecommerce constants,
those are already gone here

AppCheck no longer beta, app distribution available, but it is beta, adjust deps

the features added are not exposed here yet,  so to us this is just a fix release

allows reversal of workaround in #6158
mikehardy added a commit that referenced this issue May 14, 2022
the upstream breaking change was removal of analytics ecommerce constants,
those are already gone here

AppCheck no longer beta, app distribution available, but it is beta, adjust deps

the features added are not exposed here yet,  so to us this is just a fix release

allows reversal of workaround in #6158
mikehardy added a commit that referenced this issue May 14, 2022
the upstream breaking change was removal of analytics ecommerce constants,
those are already gone here

AppCheck no longer beta, app distribution available, but it is beta, adjust deps

the features added are not exposed here yet,  so to us this is just a fix release

allows reversal of workaround in #6158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants