Skip to content

Multiple problems when app is running in the background for long periods of time #962

@willbattel

Description

@willbattel

I'm not sure if this is a bug or not. If you'd rather I close this and discuss on Discord I can, but there are so many simultaneous discussions on Discord that sometimes it is hard to get answers.

Issue

All Firebase modules are working flawlessly when app is in the foreground, and for some time while in the background. After some time passes, we have trouble logging events and getting user auth tokens.

For example, we're having trouble with both of these:

Firebase.auth().currentUser.getIdToken(true).then((token) => {
    doSomethingWithToken(token);
});
Firebase.analytics().logEvent('some_event', {
    parameter1: 1,
    parameter2: 'B'
});

After some period of time we can't seem to get any new tokens, so our app starts to send expired tokens with it's requests to Cloud Functions, resulting in 403 errors. When we can't get any new tokens, the analytics events also stop logging.

For example, we sent roughly 230,000 HTTP requests to Cloud Functions with auth tokens attached in the past 30 days. Roughly 55,000 of those failed from expired tokens. We log an analytic event on the client every time a request is sent, and we only received roughly 175,000 analytic events. Call me crazy but thats one hell of a coincidence.

Environment

  1. Application Target Platform: iOS (we target both but have not tested on Android)
  1. Development Operating System: macOS High Sierra
  1. Build Tools: Xcode 9.2, iOS 10.0 through 11.3
  1. React Native version: 0.54.4
  1. RNFirebase Version: 3.3.1
  1. Firebase Module: Only noticed on Authentication and Analytics but it likely isn't just those

This was my conversation with the author of react-native-background-geolocation while I was trying to determine if it was that plugin or this one that was choking. It may or may not be helpful but I thought I'd link it just in case.

Any ideas? Thanks.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions