firebase / firebase/firebase-ios-sdk
FirebaseAnalytics sessionID / sessionIDWithCompletion returning 0 occasionally without error?
- Dominant language
- C++
- Stars
- 6.7k
- Forks
- 1.8k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 72
Description
### Description
Hi there - been fuzzing the iOS platform in react-native-firebase with a new massively parallel test run feature in CI, and I've noticed that occasionally we get zeros back for analytics session ID - though that can't be a valid session can it?
We don't return a value if the error object is defined, so it appears this is an erroneous return value.
Heard internally @ Invertase that this turns up on FlutterFire occasionally as well, causing a CI run to false-negative and I assume would impact users as well. Plural of anecdote is anecdata not data, but that gives me a little more confidence this is a problem.
It only happens occasionally so it is likely something race-y in firebase-ios-sdk and I'm curious if
a) a zero session id with no error object is ever a valid combination?
b) if anyone else has seen this or I'm blazing trail here and it needs more investigation
I'm going to bend a zero return value to an error at the react-native-firebase layer as I assume the answer to item A above is "nope, that shouldn't happen..."
Our implementation is dead-simple:
https://github.com/invertase/react-native-firebase/blob/f8d5a9d5cc811d2601e0fc0f32b58ffdd98cfff2/packages/analytics/ios/RNFBAnalytics/RNFBAnalyticsModule.m#L128-L139
My latest test run where I saw this - failed with this zero sessionId / no-error combo 2 out of 30 runs
https://github.com/invertase/react-native-firebase/actions/runs/17225729926/job/48869796447#step:25:3873
### Reproducing the issue
_No response_
### Firebase SDK Version
12.1.0
### Xcode Version
16.4.0
### Installation Method
CocoaPods
### Firebase Product(s)
Analytics
### Targeted Platforms
iOS
### Relevant Log Output
```shell
```
### If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
```json
Replace this line with the contents of your Package.resolved.
```
### If using CocoaPods, the project's Podfile.lock
The Podfile.lock was erroring on issue creation because it is too large.
Have no fear, it's generally available on github though :-)
https://github.com/invertase/react-native-firebase/blob/f8d5a9d5cc811d2601e0fc0f32b58ffdd98cfff2/tests/ios/Podfile.lock
Contributor guide
Assessment
This issue has not been assessed yet.