firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

πŸ› [cloud_firestore] NNBD upgrade crashes #4948

Closed rich-j closed 3 years ago

rich-j commented 3 years ago

Bug report

Upgrade to cloud_firestore: ^0.17.0-1.0.nullsafety.0, run program, hard crash - i.e. lost connection to device

iOS system.log shows:

Feb  3 19:05:58 ergine com.apple.CoreSimulator.SimDevice.8ECB0140-7D02-43A2-AD95-9B50E66AA13A[8813] (UIKitApplication:com.xx.yy[6eaf][rb-legacy][94870]): Service exited due to SIGABRT
Feb  3 19:05:58 ergine diagnosticd[8851]: System mode client stopped - log (94591) - clearing mode: 0x0, still active: 0x9
Feb  3 19:05:58 ergine diagnosticd[8851]: Posting stream filter: "{
        global = 38655164416;
    }"
Feb  3 19:05:58 ergine com.apple.CoreSimulator.SimDevice.8ECB0140-7D02-43A2-AD95-9B50E66AA13A[8813] (com.apple.xpc.launchd.oneshot.0x10000013.log[94591]): Service exited due to SIGTERM | sent by simctl[94588]

Downgrade to cloud_firestore: ^0.16.0 - all works again.

Steps to reproduce

  _firestore
    .collection('sync')
    .doc(dataSegment.toString())
    .snapshots()

We can step to the Flutter service in platform_channel.dart line 149 with values:

Stepping over the binaryMessager.send method it will crash.

  Future<T?> _invokeMethod<T>(String method, { required bool missingOk, dynamic arguments }) async {
    assert(method != null);
    final ByteData? result = await binaryMessenger.send(
      name,
      codec.encodeMethodCall(MethodCall(method, arguments)),
    );

Here's the working dependencies with the failing versions commented out

  cloud_firestore: ^0.16.0   #0.17.0-1.0.nullsafety.0
  firebase_auth: ^0.20.0   #0.21.0-1.1.nullsafety.1
  firebase_core: ^0.7.0   #0.8.0-1.0.nullsafety.1
  google_sign_in: ^4.5.9   #5.0.0-nullsafety
  http: ^0.12.2  #0.13.0-nullsafety.0
markusaksli-nc commented 3 years ago

I'm seeing a crash as well on the latest master 1.26.0-18.0.pre.187 with cloud_firestore: ^0.17.0-1.0.nullsafety.0 on a physical iPhone.

flutter doctor -v ```console [βœ“] Flutter (Channel master, 1.26.0-18.0.pre.187, on macOS 11.1 20C69 darwin-arm, locale en-GB) β€’ Flutter version 1.26.0-18.0.pre.187 at /Users/nevercode/development/flutter_master β€’ Framework revision e96ce0ecb4 (4 hours ago), 2021-02-04 02:46:03 -0500 β€’ Engine revision 5e50f4bad3 β€’ Dart version 2.12.0 (build 2.12.0-285.0.dev) [βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.3) β€’ Android SDK at /Users/nevercode/Library/Android/sdk β€’ Platform android-30, build-tools 30.0.3 β€’ Java binary at: /Users/nevercode/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) β€’ All Android licenses accepted. [βœ“] Xcode - develop for iOS and macOS β€’ Xcode at /Applications/Xcode.app/Contents/Developer β€’ Xcode 12.4, Build version 12D4e β€’ CocoaPods version 1.10.1 [βœ“] Chrome - develop for the web β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [βœ“] Android Studio (version 4.1) β€’ Android Studio at /Users/nevercode/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents β€’ Flutter plugin can be installed from: οΏ½ https://plugins.jetbrains.com/plugin/9212-flutter β€’ Dart plugin can be installed from: οΏ½ https://plugins.jetbrains.com/plugin/6351-dart β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [βœ“] Connected device (4 available) β€’ Nevercode’s iPhone (mobile) β€’ b668e524315069f3db3661ac11ff1f66afafebdb β€’ ios β€’ iOS 14.4 β€’ iPhone 12 Pro Max (mobile) β€’ 42B7F3DF-3053-419B-BA8F-FF1218F7A174 β€’ ios β€’ com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) β€’ macOS (desktop) β€’ macos β€’ darwin-arm64 β€’ macOS 11.1 20C69 darwin-arm β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 88.0.4324.96 β€’ No issues found! ```
Logs ```console Syncing files to device Nevercode’s iPhone... *** Assertion failure in void firebase::firestore::remote::(anonymous namespace)::HostConfigMap::UseInsecureChannel(const std::string &)(), /var/folders/mk/9ccbvq8x00q20q0f7mfxbtrw00bzqz/T/ZipRelease/2020-12-07T14-07-48/project/Pods/FirebaseFirestore/Firestore/core/src/remote/grpc_connection.cc:114 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Empty host name (expected !host.empty())' *** First throw call stack: (0x19fbf19d8 0x1b3f77b54 0x19fb0050c 0x1a0e49238 0x104735978 0x1047354c8 0x10478d7d0 0x10478d870 0x104782180 0x104720988 0x10475aa14 0x10471b520 0x1048155e0 0x19f82a280 0x19f7d2dcc 0x19f7d38a8 0x19f7dd338 0x1e84155a4 0x1e8418874) libc++abi.dylib: terminating with uncaught exception of type NSException * thread #2, queue = 'com.google.firebase.firestore', stop reason = signal SIGABRT frame #0: 0x00000001cbb3084c libsystem_kernel.dylib`__pthread_kill + 8 libsystem_kernel.dylib`__pthread_kill: -> 0x1cbb3084c <+8>: b.lo 0x1cbb30868 ; <+36> 0x1cbb30850 <+12>: stp x29, x30, [sp, #-0x10]! 0x1cbb30854 <+16>: mov x29, sp 0x1cbb30858 <+20>: bl 0x1cbb0df5c ; cerror_nocancel Target 0: (Runner) stopped. Lost connection to device. Failed to send request: {"jsonrpc":"2.0","id":"28","method":"ext.flutter.inspector.disposeGroup","params":{"objectGroup":"selection_10","isolateId":"isolates/1917303253089515"}} ```
amumm commented 3 years ago

I am seeing crashing on android as well. This works fine on 0.16.0

E/DartMessenger(28588): Uncaught exception in binary message listener
E/DartMessenger(28588): java.lang.NullPointerException: Provided settings must not be null.
E/DartMessenger(28588):     at com.google.firebase.firestore.util.Preconditions.checkNotNull(Preconditions.java:147)
E/DartMessenger(28588):     at com.google.firebase.firestore.FirebaseFirestore.setFirestoreSettings(FirebaseFirestore.java:193)
E/DartMessenger(28588):     at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readFirestoreInstance(FlutterFirebaseFirestoreMessageCodec.java:241)
E/DartMessenger(28588):     at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:205)
E/DartMessenger(28588):     at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
E/DartMessenger(28588):     at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:182)
E/DartMessenger(28588):     at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
E/DartMessenger(28588):     at io.flutter.plugin.common.StandardMessageCodec.readValueOfType(StandardMessageCodec.java:410)
E/DartMessenger(28588):     at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:224)
E/DartMessenger(28588):     at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
E/DartMessenger(28588):     at io.flutter.plugin.common.StandardMethodCodec.decodeMethodCall(StandardMethodCodec.java:48)
E/DartMessenger(28588):     at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:165)
E/DartMessenger(28588):     at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/DartMessenger(28588):     at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/DartMessenger(28588):     at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(28588):     at android.os.MessageQueue.next(MessageQueue.java:326)
E/DartMessenger(28588):     at android.os.Looper.loop(Looper.java:160)
E/DartMessenger(28588):     at android.app.ActivityThread.main(ActivityThread.java:6669)
E/DartMessenger(28588):     at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(28588):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/DartMessenger(28588):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

════════ Exception caught by services library ══════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel plugins.flutter.io/firebase_firestore/document/d697b0cc-c814-4687-a258-125545ef4ff3:
MissingPluginException(No implementation found for method listen on channel plugins.flutter.io/firebase_firestore/document/d697b0cc-c814-4687-a258-125545ef4ff3)

When the exception was thrown, this was the stack
#0      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:156
<asynchronous suspension>
#1      EventChannel.receiveBroadcastStream.<anonymous closure>
package:flutter/…/services/platform_channel.dart:545
<asynchronous suspension>
Johann-Hagen commented 3 years ago

Would be really great to have this fixed ASAP

sma commented 3 years ago

I get a different error direct on macos launch, which however is also caused by the nullsafety version, I think:

2021-02-06 10:23:28.771 Tellorium[19062:1627240] *** Assertion failure in void firebase::firestore::remote::(anonymous namespace)::HostConfigMap::UseInsecureChannel(const std::string &)(), /Users/sma/Work/tellorium_poc/macos/Pods/FirebaseFirestore/Firestore/core/src/remote/grpc_connection.cc:114
2021-02-06 10:23:28.805 Tellorium[19062:1627240] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Empty host name (expected !host.empty())'
LRNZ09 commented 3 years ago

I'm getting the same error as @sma using version 0.17.0-1.0.nullsafety.0 of cloud_firestore

Yayo-Arellano commented 3 years ago

Same error

Uncaught exception in binary message listener
java.lang.NullPointerException: Provided settings must not be null.
at com.google.firebase.firestore.util.Preconditions.checkNotNull(Preconditions.java:147)
at com.google.firebase.firestore.FirebaseFirestore.setFirestoreSettings(FirebaseFirestore.java:193)
at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readFirestoreInstance(FlutterFirebaseFirestoreMessageCodec.java:241)
at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:205)
at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
at io.flutter.plugin.common.StandardMessageCodec.readValueOfType(StandardMessageCodec.java:410)
at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:224)
at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
at io.flutter.plugin.common.StandardMethodCodec.decodeMethodCall(StandardMethodCodec.java:48)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 7883): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method DocumentReference#set on channel plugins.flutter.io/firebase_firestore)
tomoyuki28jp commented 3 years ago

When I flutter run -d macos the cloud_firestore example app from the master branch, I get the same error with @sma.

flutter run -d macos                                                                                                         master βœ– ✱
Launching lib/main.dart on macOS in debug mode...
Building macOS application...
Syncing files to device macOS...                                    57ms

Flutter run key commands.
r Hot reload. πŸ”₯πŸ”₯πŸ”₯
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

An Observatory debugger and profiler on macOS is available at: http://127.0.0.1:61273/p0RRDT93U9M=/
2021-02-14 13:52:36.191 example[6125:702185] *** Assertion failure in void firebase::firestore::remote::(anonymous namespace)::HostConfigMap::UseInsecureChannel(const std::string &)(), /Users/tomo/src/flutter/flutterfire/packages/cloud_firestore/cloud_firestore/example/macos/Pods/FirebaseFirestore/Firestore/core/src/remote/grpc_connection.cc:114
2021-02-14 13:52:36.216 example[6125:702185] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Empty host name (expected !host.empty())'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff204886af __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff201c03c9 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff204b1512 +[NSException raise:format:arguments:] + 88
    3   Foundation                          0x00007fff212a7197 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    4   FirebaseFirestore                   0x000000010490dfa7 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343
    5   FirebaseFirestore                   0x000000010490d455 _ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 53
    6   FirebaseFirestore                   0x0000000104a7b3ed _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 45
    7   FirebaseFirestore                   0x0000000104a7b4a1 _ZN8firebase9firestore4util8internal13FailAssertionEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEES4_ + 177
    8   FirebaseFirestore                   0x0000000104a3a785 _ZN8firebase9firestore6remote12_GLOBAL__N_113HostConfigMap18UseInsecureChannelERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE + 101
    9   FirebaseFirestore                   0x0000000104a3a70d _ZN8firebase9firestore6remote14GrpcConnection18UseInsecureChannelERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 29
    10  FirebaseFirestore                   0x000000010488f46a _ZN8firebase9firestore6remote9DatastoreC2ERKNS0_4core12DatabaseInfoERKNSt3__110shared_ptrINS0_4util10AsyncQueueEEENS8_INS0_4auth19CredentialsProviderEEEPNS1_19ConnectivityMonitorEPNS1_24FirebaseMetadataProviderE + 554
    11  FirebaseFirestore                   0x000000010488f805 _ZN8firebase9firestore6remote9DatastoreC1ERKNS0_4core12DatabaseInfoERKNSt3__110shared_ptrINS0_4util10AsyncQueueEEENS8_INS0_4auth19CredentialsProviderEEEPNS1_19ConnectivityMonitorEPNS1_24FirebaseMetadataProviderE + 53
    12  FirebaseFirestore                   0x00000001049ab83e _ZNSt3__122__compressed_pair_elemIN8firebase9firestore6remote9DatastoreELi1ELb0EEC2IJRNS2_4core12DatabaseInfoERNS_10shared_ptrINS2_4util10AsyncQueueEEERNSA_INS2_4auth19CredentialsProviderEEEOPNS3_19ConnectivityMonitorEOPNS3_24FirebaseMetadataProviderEEJLm0ELm1ELm2ELm3ELm4EEEENS_21piecewise_construct_tENS_5tupleIJDpT_EEENS_15__tuple_indicesIJXspT0_EEEE + 174
    13  FirebaseFirestore                   0x00000001049ab735 _ZNSt3__117__compressed_pairINS_9allocatorIN8firebase9firestore6remote9DatastoreEEES5_EC2IJRS6_EJRNS3_4core12DatabaseInfoERNS_10shared_ptrINS3_4util10AsyncQueueEEERNSD_INS3_4auth19CredentialsProviderEEEOPNS4_19ConnectivityMonitorEOPNS4_24FirebaseMetadataProviderEEEENS_21piecewise_construct_tENS_5tupleIJDpT_EEENST_IJDpT0_EEE + 165
    14  FirebaseFirestore                   0x00000001049ab18a _ZNSt3__117__compressed_pairINS_9allocatorIN8firebase9firestore6remote9DatastoreEEES5_EC1IJRS6_EJRNS3_4core12DatabaseInfoERNS_10shared_ptrINS3_4util10AsyncQueueEEERNSD_INS3_4auth19CredentialsProviderEEEOPNS4_19ConnectivityMonitorEOPNS4_24FirebaseMetadataProviderEEEENS_21piecewise_construct_tENS_5tupleIJDpT_EEENST_IJDpT0_EEE + 74
    15  FirebaseFirestore                   0x00000001049ab044 _ZNSt3__120__shared_ptr_emplaceIN8firebase9firestore6remote9DatastoreENS_9allocatorIS4_EEEC2IJRNS2_4core12DatabaseInfoERNS_10shared_ptrINS2_4util10AsyncQueueEEERNSC_INS2_4auth19CredentialsProviderEEEPNS3_19ConnectivityMonitorEPNS3_24FirebaseMetadataProviderEEEES6_DpOT_ + 276
    16  FirebaseFirestore                   0x00000001049aabad _ZNSt3__120__shared_ptr_emplaceIN8firebase9firestore6remote9DatastoreENS_9allocatorIS4_EEEC1IJRNS2_4core12DatabaseInfoERNS_10shared_ptrINS2_4util10AsyncQueueEEERNSC_INS2_4auth19CredentialsProviderEEEPNS3_19ConnectivityMonitorEPNS3_24FirebaseMetadataProviderEEEES6_DpOT_ + 61
    17  FirebaseFirestore                   0x000000010499d2c8 _ZNSt3__1L11make_sharedIN8firebase9firestore6remote9DatastoreEJRNS2_4core12DatabaseInfoERNS_10shared_ptrINS2_4util10AsyncQueueEEERNS8_INS2_4auth19CredentialsProviderEEEPNS3_19ConnectivityMonitorEPNS3_24FirebaseMetadataProviderEEEENS_9enable_ifIXntsr8is_arrayIT_EE5valueENS8_ISM_EEE4typeEDpOT0_ + 328
    18  FirebaseFirestore                   0x000000010499c83f _ZN8firebase9firestore4core15FirestoreClient10InitializeERKNS0_4auth4UserERKNS0_3api8SettingsE + 1503
    19  FirebaseFirestore                   0x00000001049a786d _ZZZN8firebase9firestore4core15FirestoreClient6CreateERKNS1_12DatabaseInfoERKNS0_3api8SettingsENSt3__110shared_ptrINS0_4auth19CredentialsProviderEEENSB_INS0_4util8ExecutorEEENSB_INSF_10AsyncQueueEEENSA_10unique_ptrINS0_6remote24FirebaseMetadataProviderENSA_14default_deleteISM_EEEEEN3$_2clENSC_4UserEENKUlvE_clEv + 61
    20  FirebaseFirestore                   0x00000001049a780d _ZNSt3__1L8__invokeIRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS3_12DatabaseInfoERKNS2_3api8SettingsENS_10shared_ptrINS2_4auth19CredentialsProviderEEENSC_INS2_4util8ExecutorEEENSC_INSG_10AsyncQueueEEENS_10unique_ptrINS2_6remote24FirebaseMetadataProviderENS_14default_deleteISN_EEEEEN3$_2clENSD_4UserEEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSV_DpOSW_ + 29
    21  FirebaseFirestore                   0x00000001049a77bd _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZZN8firebase9firestore4core15FirestoreClient6CreateERKNS5_12DatabaseInfoERKNS4_3api8SettingsENS_10shared_ptrINS4_4auth19CredentialsProviderEEENSE_INS4_4util8ExecutorEEENSE_INSI_10AsyncQueueEEENS_10unique_ptrINS4_6remote24FirebaseMetadataProviderENS_14default_deleteISP_EEEEEN3$_2clENSF_4UserEEUlvE_EEEvDpOT_ + 29
    22  FirebaseFirestore                   0x00000001049a778d _ZNSt3__110__function12__alloc_funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 29
    23  FirebaseFirestore                   0x00000001049a639e _ZNSt3__110__function6__funcIZZN8firebase9firestore4core15FirestoreClient6CreateERKNS4_12DatabaseInfoERKNS3_3api8SettingsENS_10shared_ptrINS3_4auth19CredentialsProviderEEENSD_INS3_4util8ExecutorEEENSD_INSH_10AsyncQueueEEENS_10unique_ptrINS3_6remote24FirebaseMetadataProviderENS_14default_deleteISO_EEEEEN3$_2clENSE_4UserEEUlvE_NS_9allocatorISU_EEFvvEEclEv + 30
    24  FirebaseFirestore                   0x00000001048722b5 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 53
    25  FirebaseFirestore                   0x000000010486f6b5 _ZNKSt3__18functionIFvvEEclEv + 21
    26  FirebaseFirestore                   0x000000010486f61a _ZN8firebase9firestore4util10AsyncQueue15ExecuteBlockingERKNSt3__18functionIFvvEEE + 186
    27  FirebaseFirestore                   0x0000000104874711 _ZZN8firebase9firestore4util10AsyncQueue4WrapERKNSt3__18functionIFvvEEEENK3$_0clEv + 33
    28  FirebaseFirestore                   0x00000001048746cd _ZNSt3__1L8__invokeIRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSC_DpOSD_ + 29
    29  FirebaseFirestore                   0x000000010487467d _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0EEEvDpOT_ + 29
    30  FirebaseFirestore                   0x000000010487464d _ZNSt3__110__function12__alloc_funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 29
    31  FirebaseFirestore                   0x00000001048733ae _ZNSt3__110__function6__funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 30
    32  FirebaseFirestore                   0x00000001048722b5 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 53
    33  FirebaseFirestore                   0x000000010486f6b5 _ZNKSt3__18functionIFvvEEclEv + 21
    34  FirebaseFirestore                   0x0000000104d0c385 _ZN8firebase9firestore4util4Task17ExecuteAndReleaseEv + 229
    35  FirebaseFirestore                   0x000000010490effd _ZN8firebase9firestore4util19ExecutorLibdispatch11InvokeAsyncEPv + 29
    36  libdispatch.dylib                   0x00007fff2016b7c7 _dispatch_client_callout + 8
    37  libdispatch.dylib                   0x00007fff201715fe _dispatch_lane_serial_drain + 606
    38  libdispatch.dylib                   0x00007fff201720cb _dispatch_lane_invoke + 375
    39  libdispatch.dylib                   0x00007fff2017bc5d _dispatch_workloop_worker_thread + 819
    40  libsystem_pthread.dylib             0x00007fff20313499 _pthread_wqthread + 314
    41  libsystem_pthread.dylib             0x00007fff20312467 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Lost connection to device.
samlythemanly commented 3 years ago

Took all day to debug but found a fix for it :)

tomoyuki28jp commented 3 years ago

@somarkoe Thank you for your work!

grinder15 commented 3 years ago

I am seeing crashing on android as well. This works fine on 0.16.0

E/DartMessenger(28588): Uncaught exception in binary message listener
E/DartMessenger(28588): java.lang.NullPointerException: Provided settings must not be null.
E/DartMessenger(28588):   at com.google.firebase.firestore.util.Preconditions.checkNotNull(Preconditions.java:147)
E/DartMessenger(28588):   at com.google.firebase.firestore.FirebaseFirestore.setFirestoreSettings(FirebaseFirestore.java:193)
E/DartMessenger(28588):   at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readFirestoreInstance(FlutterFirebaseFirestoreMessageCodec.java:241)
E/DartMessenger(28588):   at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:205)
E/DartMessenger(28588):   at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
E/DartMessenger(28588):   at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:182)
E/DartMessenger(28588):   at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
E/DartMessenger(28588):   at io.flutter.plugin.common.StandardMessageCodec.readValueOfType(StandardMessageCodec.java:410)
E/DartMessenger(28588):   at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestoreMessageCodec.readValueOfType(FlutterFirebaseFirestoreMessageCodec.java:224)
E/DartMessenger(28588):   at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:317)
E/DartMessenger(28588):   at io.flutter.plugin.common.StandardMethodCodec.decodeMethodCall(StandardMethodCodec.java:48)
E/DartMessenger(28588):   at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:165)
E/DartMessenger(28588):   at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/DartMessenger(28588):   at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/DartMessenger(28588):   at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(28588):   at android.os.MessageQueue.next(MessageQueue.java:326)
E/DartMessenger(28588):   at android.os.Looper.loop(Looper.java:160)
E/DartMessenger(28588):   at android.app.ActivityThread.main(ActivityThread.java:6669)
E/DartMessenger(28588):   at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(28588):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/DartMessenger(28588):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

════════ Exception caught by services library ══════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel plugins.flutter.io/firebase_firestore/document/d697b0cc-c814-4687-a258-125545ef4ff3:
MissingPluginException(No implementation found for method listen on channel plugins.flutter.io/firebase_firestore/document/d697b0cc-c814-4687-a258-125545ef4ff3)

When the exception was thrown, this was the stack
#0      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:156
<asynchronous suspension>
#1      EventChannel.receiveBroadcastStream.<anonymous closure>
package:flutter/…/services/platform_channel.dart:545
<asynchronous suspension>

I've also encountered this.

[√] Flutter (Channel beta, 1.26.0-17.3.pre, on Microsoft Windows [Version 10.0.18363.1379], locale en-US)
    β€’ Flutter version 1.26.0-17.3.pre at C:\src\flutter
    β€’ Framework revision 4b50ca7f7f (9 days ago), 2021-02-04 19:44:27 -0800
    β€’ Engine revision 2c527d6c7e
    β€’ Dart version 2.12.0 (build 2.12.0-259.8.beta)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    β€’ Android SDK at C:\Users\Dev-01\AppData\Local\Android\sdk
    β€’ Platform android-30, build-tools 30.0.3
    β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    β€’ All Android licenses accepted.

[√] Android Studio (version 4.1.0)
    β€’ Android Studio at C:\Program Files\Android\Android Studio
    β€’ Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
    β€’ sdk gphone x86 arm (mobile) β€’ emulator-5554 β€’ android-x86 β€’ Android 11 (API 30) (emulator)

β€’ No issues found!
rsixel commented 3 years ago

Just an update about the information you asked me on #4999 :

Upgraded my system to macOS Big Sur 11.2 an XCode 12.4 and got:

flutter doctor -v

[βœ“] Flutter (Channel beta, 1.26.0-17.5.pre, on macOS 11.2 20D64 darwin-x64, locale pt-BR)
    β€’ Flutter version 1.26.0-17.5.pre at /Volumes/HDD/dev/flutter
    β€’ Framework revision 1fe38dcb5f (5 days ago), 2021-02-10 16:25:47 -0800
    β€’ Engine revision d4453f6018
    β€’ Dart version 2.12.0 (build 2.12.0-259.9.beta)

[βœ“] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    β€’ Android SDK at /Volumes/HDD/dev/android/sdk
    β€’ Platform android-30, build-tools 29.0.2
    β€’ ANDROID_SDK_ROOT = /Volumes/HDD/dev/android
    β€’ Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 12.4, Build version 12D4e
    β€’ CocoaPods version 1.10.1

[!] Android Studio (not installed)
    β€’ Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[βœ“] VS Code (version 1.53.2)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.19.0

[βœ“] Connected device (1 available)
    β€’ iPhone 12 Pro Max (mobile) β€’ FDDDCE3A-896C-4BD5-BE61-D96ACE70064E β€’ ios β€’ com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)

! Doctor found issues in 1 category.

flutter pub deps -- --style=compact

Dart SDK 2.12.0-259.9.beta
Flutter SDK 1.26.0-17.5.pre
...
dependencies:
- cloud_firestore 0.17.0-1.0.nullsafety.0 [cloud_firestore_platform_interface cloud_firestore_web firebase_core firebase_core_platform_interface flutter meta]
- cupertino_list_tile 0.2.0-nullsafety.0 [cupertino_icons flutter]
- cupertino_radio_choice 1.0.1+1 [flutter]
- enum_to_string 1.0.14
- firebase_auth 0.21.0-1.1.nullsafety.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 0.8.0-1.0.nullsafety.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_ui 1.0.8 [flutter flutter_twitter_login firebase_auth google_sign_in flutter_facebook_login apple_sign_in]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math]
- flutter_masked_text 0.8.1 [flutter]
- flutter_platform_widgets 1.0.0-nullsafety.0 [flutter]
- intl 0.17.0 [clock path]
- material_search 0.2.8 [mockito meta flutter]
- open_file 4.0.0-nullsafety.0 [flutter ffi]
- path_provider 2.0.0-nullsafety [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- pdf 3.0.0-nullsafety.1 [archive barcode crypto image meta path_parsing vector_math xml]
- printing 5.0.0-nullsafety.1 [flutter flutter_web_plugins image js meta pdf plugin_platform_interface]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- _fe_analyzer_shared 14.0.0 [meta]
- analyzer 0.41.2 [_fe_analyzer_shared args cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- apple_sign_in 0.1.0 [flutter]
- archive 3.0.0-nullsafety.0 [crypto path]
- args 2.0.0
- async 2.5.0 [collection]
- barcode 2.0.0-nullsafety [meta qr]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.1.0
- charcode 1.2.0
- cli_util 0.2.0 [path]
- clock 1.1.0
- cloud_firestore_platform_interface 4.0.0-1.0.nullsafety.0 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 0.4.0-1.0.nullsafety.0 [cloud_firestore_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.15.0
- convert 2.1.1 [charcode typed_data]
- coverage 0.15.2 [args logging package_config path source_maps stack_trace vm_service]
- crypto 3.0.0-nullsafety.0 [collection typed_data]
- cupertino_icons 1.0.2
- fake_async 1.2.0 [clock collection]
- ffi 0.3.0-nullsafety.1
- file 6.0.0-nullsafety.4 [meta path]
- firebase_auth_platform_interface 4.0.0-1.1.nullsafety.1 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 0.4.0-1.1.nullsafety.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.0.0-1.0.nullsafety.1 [flutter meta plugin_platform_interface]
- firebase_core_web 0.3.0-1.0.nullsafety.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- flutter_facebook_login 3.0.0 [flutter collection]
- flutter_twitter_login 1.1.0 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- google_sign_in 5.0.0-nullsafety [google_sign_in_platform_interface flutter meta]
- google_sign_in_platform_interface 2.0.0-nullsafety [flutter meta quiver]
- http_multi_server 2.2.0 [async]
- http_parser 4.0.0-nullsafety [charcode collection source_span string_scanner typed_data]
- image 3.0.0-nullsafety.0 [archive xml meta]
- io 0.3.4 [charcode meta path string_scanner]
- js 0.6.3
- logging 1.0.0
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- mime 1.0.0
- mockito 3.0.2 [collection matcher meta test]
- node_interop 1.2.1 [js]
- node_io 1.1.1 [node_interop path]
- node_preamble 1.4.13
- package_config 1.9.3 [path charcode]
- path 1.8.0
- path_parsing 0.2.0-nullsafety.0 [vector_math meta]
- path_provider_linux 0.2.0-nullsafety [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.5-nullsafety [flutter]
- path_provider_platform_interface 2.0.0-nullsafety [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.1.0-nullsafety.2 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.10.0
- petitparser 4.0.0-nullsafety.1 [meta]
- platform 3.0.0
- plugin_platform_interface 1.1.0-nullsafety.2 [meta]
- pool 1.5.0 [async stack_trace]
- process 4.0.0-nullsafety.4 [file path platform]
- pub_semver 1.4.4 [collection]
- qr 2.0.0-nullsafety.1 [meta]
- quiver 3.0.0-nullsafety.3 [matcher]
- shelf 1.0.0-nullsafety.0 [async collection http_parser path stack_trace stream_channel]
- shelf_packages_handler 2.0.1 [path shelf shelf_static]
- shelf_static 0.2.9+2 [convert http_parser mime path shelf]
- shelf_web_socket 0.2.4 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_map_stack_trace 2.1.0 [path stack_trace source_maps]
- source_maps 0.10.10 [source_span]
- source_span 1.8.0 [charcode collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test 1.16.2 [analyzer async boolean_selector coverage http_multi_server io js node_preamble package_config path pedantic pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core]
- test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- test_core 0.3.13 [analyzer async args boolean_selector collection coverage glob io meta package_config path pedantic pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api]
- typed_data 1.3.0 [collection]
- vector_math 2.1.0
- vm_service 6.0.1
- watcher 0.9.7+15 [async path pedantic]
- web_socket_channel 1.2.0 [async crypto stream_channel]
- webkit_inspection_protocol 0.7.5 [logging]
- win32 2.0.0-nullsafety.10 [ffi]
- xdg_directories 0.2.0-nullsafety.1 [meta path process]
- xml 5.0.0-nullsafety.1 [collection meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]

And still gettin crash. With following message running flutter launch -v :

[+42568 ms] Service protocol connection closed. [ +7 ms] Lost connection to device. [ +9 ms] DevFS: Deleting filesystem on the device (file:///Users/ricardo/Library/Developer/CoreSimulator/Devices/FDDDCE3A-896C-4BD5-BE61-D96ACE70064E/data/Containers/Data/Application/12219046-A3C2-441E-AB04-7FA05B4332BE/tmp/**RNNOU1/***/) [ +255 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed

On iOS Simulator Crash report got following:

Process:               Runner [23746]
Path:                  /Users/USER/Library/Developer/CoreSimulator/Devices/FDDDCE3A-896C-4BD5-BE61-D96ACE70064E/data/Containers/Bundle/Application/62791FA0-DDCC-40DF-B826-EB6CB545F1E2/Runner.app/Runner
Identifier:            Runner
Version:               0.0.1 (0.0.1)
Code Type:             X86-64 (Native)
Parent Process:        launchd_sim [9036]
Responsible:           SimulatorTrampoline [891]
User ID:               501

Date/Time:             2021-02-15 14:45:29.781 -0300
OS Version:            macOS 11.2 (20D64)
Report Version:        12
Anonymous UUID:        EEE01AF9-B986-BDAA-3771-0A508134A06D

Time Awake Since Boot: 7800 seconds

System Integrity Protection: disabled

Crashed Thread:        1  Dispatch queue: com.google.firebase.firestore

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Empty host name (expected !host.empty())'
terminating with uncaught exception of type NSException
abort() called

Remember, the same code get auth and after do right query on stable (non nullsafety) channel.

mono0926 commented 3 years ago

As a workaround until it is fixed in #5031, the solution is to call the following after await Firebase.initializeApp();:

FirebaseFirestore.instance.settings = const Settings();
oussaid1 commented 3 years ago

this works thanks for the fix, FirebaseFirestore.instance.settings = const Settings();