GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
1.11k stars 153 forks source link

Firestore 1.13.0 throw this crashing just on iphone ==> Firestore instance has already been started and its settings can no longer be changed. You can only set settings before calling any other methods on a Firestore instance. #575

Closed jordijimenezguil closed 1 month ago

jordijimenezguil commented 2 months ago

Hello :)

I have a KMP app that is using Firestore version 1.13.0 and on the Android device all works fine but on iphone devices (simulator and physical) throw this crash:

FIRIllegalStateException', reason: 'Firestore instance has already been started and its settings can no longer be changed. You can only set settings before calling any other methods on a Firestore instance.' *** First throw call stack:

I've reviewed my code (inclusive all initializations and configurations) and seems all is ok. What's happen?

Even, for example, I'm using Firebase.auth for anonymous login in the same app and works fine for all devices (Android and iphone). then firebase initialization works fine, right?

Log of auth in firebase 2024-07-29 00:01:43.832034+0200 ------[41941:4723272] 🟢 (SG-KClassImpl) Firebase Auth Token CLCdQuG4UEhO0ZLfU2WCItnKM3B2

Why throws Firestore this crash just in iphone?

This is the Firestore call on my datasource:

          suspend fun create(user: User): User = try {
                   Firebase.firestore
                      .collection(USER_COLLECTION)
                      .document(user.id)
                      .set(user)
                      .let { user }
              } catch (exception: Exception) {
                  throw DatasourceErrorException
                      .OperationDataEntityErrorException(
                          DatasourceEntityType.User,
                          operationData = DatasourceOperationType.Create,
                          cause = exception
                      )
              }

I don't understand where I'm settings "the settings before this call". Maybe it's a bug of sdk?

Please, help me :)

Thanks in advance

venator85 commented 2 months ago

I'm having the same issue.

A temporary workaround is to downgrade to 1.12.0.

kaidotarma commented 1 month ago

This should be fixed by https://github.com/GitLiveApp/firebase-kotlin-sdk/pull/562 , but we need to wait for a release. @nbransby @Daeda88 could we please get a new release any time soon? :) last release was 1.5 months ago

nbransby commented 1 month ago

Working on it, it's going to be a major release as it contains breaking changes and we want bundle it together with some other breaking changes

fethij commented 1 month ago

@nbransby @Daeda88 any eta on the release?

nbransby commented 1 month ago

@fethij released