Description
Describe the bug
The bug is related somehow to the connection with firebase (even though autentication works) so it has two types of crashes:
- Cloud Function crashes and returns a weird String
2019-10-16 15:39:14.272711+0300 Runner[2049:1095548] flutter: d8xdzLNCIKQ:APA91bEzGq_1PllS2mZQaBuDE4uYxBlQnrLok8X_XkdFg4dwNt69d2FHgCHq_lQlOGr7DWEHUqKWlOkMUKU2lt8pyalAwIby9B_D_Loyls_YEt88jifezPBKmowfkif0u2KofBCUOeRb
instead of the actual result of the function -
Every time it crashes I saw this error that's not very revealing:
2019-10-16 15:39:13.697858+0300 Runner[2049:1095548] [VERBOSE-2:shell.cc(178)] Dart Error: Unhandled exception:
Invalid argument(s): Dart_InvokeClosure expects argument 'closure' to be of type Instance.
null
A couple of times I was able to get this timeout error:
Task <6729D3D9-F64C-4444-9A88-7BFBC851B318>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x280771020 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <6729D3D9-F64C-4444-9A88-7BFBC851B318>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <6729D3D9-F64C-4444-9A88-7BFBC851B318>.<1>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://europe-west1-aliniapp.cloudfunctions.net/unreadMessages, NSErrorFailingURLKey=https://europe-west1-aliniapp.cloudfunctions.net/unreadMessages, _kCFStreamErrorDomainKey=4}
- The other type of error occurs if I just do a .get for a document in firebase:
019-10-16 16:33:49.703409+0300 Runner[2103:1113206] [VERBOSE-2:shell.cc(178)] Dart Error: Unhandled exception:
Invalid argument(s): Dart_InvokeClosure expects argument 'closure' to be of type Instance.
null
2019-10-16 16:33:49.934156+0300 Runner[2103:1113202] 6.10.0 - [Firebase/Analytics][I-ACS025008] Cannot query for public user properties when Analytics is disabled
2019-10-16 16:33:49.955100+0300 Runner[2103:1113206] flutter: Firebase user here is
2019-10-16 16:33:49.956833+0300 Runner[2103:1113206] flutter: FirebaseUser({displayName: null, providerId: Firebase, uid: sJ2l2J2kCLduOZrpn4t0DZGNLZ32, phoneNumber: +40723065763, isEmailVerified: false, providerData: [{email: null, providerId: phone, photoUrl: null, displayName: null, uid: null, phoneNumber: +40723065763}], email: null, photoUrl: null, lastSignInTimestamp: 1570795116933, isAnonymous: false, creationTimestamp: 1570703113662})
2019-10-16 16:33:49.965574+0300 Runner[2103:1113206] [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: type 'String' is not a subtype of type 'Map<dynamic, dynamic>'
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:13)
<asynchronous suspension>
#1 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:344:48)
<asynchronous suspension>
#2 DocumentReference.get (package:cloud_firestore/src/document_reference.dart:84:33)
<asynchronous suspension>
#3 _fetchLanguageAction (package:alini_patient/config/config_middleware.dart:61:102)
<asynchronous suspension>
#4 TypedMiddleware.call (package:redux/src/utils.dart:218:7)
#5 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#6 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#7 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#8 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#9 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#10 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#11 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#12 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#13 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#14 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#15 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#16 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#17 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#18 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#19 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#20 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#21 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#22 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#23 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#24 TypedMiddleware.call (package:redux/src/utils.dart:220:11)
#25 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#26 EpicMiddleware.call (package:redux_epics/src/epic_middleware.dart:47:9)
#27 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#28 EpicMiddleware.call (package:redux_epics/src/epic_middleware.dart:47:9)
#29 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#30 EpicMiddleware.call (package:redux_epics/src/epic_middleware.dart:47:9)
#31 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#32 EpicMiddleware.call (package:redux_epics/src/epic_middleware.dart:47:9)
#33 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#34 EpicMiddleware.call (package:redux_epics/src/epic_middleware.dart:47:9)
#35 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#36 EpicMiddleware.call (package:redux_epics/src/epic_middleware.dart:47:9)
#37 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#38 NavigationMiddleware.call (package:alini_patient/redux/middleware.dart:333:9)
<asynchronous suspension>
#39 Store._createDispatchers.<anonymous closure> (package:redux/src/store.dart:238:43)
#40 Store.dispatch (package:redux/src/store.dart:250:20)
#41 new InitViewModel.fromStore.<anonymous closure> (package:alini_patient/init/init_view_model.dart:38:15)
#42 _InitScreenState._onWillChange (package:alini_patient/init/init_screen.dart:73:21)
#43 _StoreStreamListenerState._init.<anonymous closure> (package:flutter_redux/flutter_redux.dart)
#44 _HandlerEventSink.add (dart:async/stream_transformers.dart:228:7)
#45 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#46 _rootRunUnary (dart:async/zone.dart:1132:38)
#47 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#48 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#49 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#50 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#51 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11)
#52 _MapStream._handleData (dart:async/stream_pipe.dart:232:10)
#53 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:164:13)
#54 _rootRunUnary (dart:async/zone.dart:1132:38)
#55 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#56 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#57 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#58 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
#59 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:707:11)
#60 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:667:7)
#61 _rootRun (dart:async/zone.dart:1120:38)
#62 _CustomZone.run (dart:async/zone.dart:1021:19)
#63 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#64 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#65 _rootRun (dart:async/zone.dart:1124:13)
#66 _CustomZone.run (dart:async/zone.dart:1021:19)
#67 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#68 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#69 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#70 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
2019-10-16 16:33:50.250149+0300 Runner[2103:1113206] [VERBOSE-2:shell.cc(178)] Dart Error: Unhandled exception:
Invalid argument(s): Dart_InvokeClosure expects argument 'closure' to be of type Instance.
null
2019-10-16 16:33:50.280044+0300 Runner[2103:1113206] [VERBOSE-2:shell.cc(178)] Dart Error: Unhandled exception:
NoSuchMethodError: Closure call with mismatched arguments: function 'call'
Receiver: Closure: () => void from Function '_startMicrotaskLoop@8048458': static.
Tried calling: call(TypedDataView(cid: 139))
Found: call() => void
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
To Reproduce
Steps to reproduce the behavior:
I just restart the app multiple times and one out of three times it crashes!
Expected behavior
I expect cloud functions to be called correctly
Additional context
It happens only on IOS
I used to have cloud function on europe-west-1 and thought it was a region issue but I also moved them to us-central and I still get the error...
Now I have them on both regions!