Closed creativecreatorormaybenot closed 2 years ago
I think it might be caused when calling getIdTokenResult
.
I guess this line is causing the issue: https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_auth/firebase_auth_web/lib/firebase_auth_web_user.dart#L15
Not sure why:
EEE
indicates the short day name.
Same issue here.. https://github.com/FirebaseExtended/flutterfire/issues/3266
You can use the following in your pubspec to use the master version until this gets released:
dependency_overrides:
firebase_auth:
git:
url: https://github.com/FirebaseExtended/flutterfire
path: packages/firebase_auth/firebase_auth
ref: cfd9a0e0dc5d2b5157fe0e61999977686fa1ddb0
firebase_auth_platform_interface:
git:
url: https://github.com/FirebaseExtended/flutterfire
path: packages/firebase_auth/firebase_auth_platform_interface
ref: cfd9a0e0dc5d2b5157fe0e61999977686fa1ddb0
firebase_auth_web:
git:
url: https://github.com/FirebaseExtended/flutterfire
path: packages/firebase_auth/firebase_auth_web
ref: cfd9a0e0dc5d2b5157fe0e61999977686fa1ddb0
Also got the issue with firebase_auth: ^0.18.0+1
.
It works with this:
dependency_overrides: firebase_auth: git: url: https://github.com/FirebaseExtended/flutterfire path: packages/firebase_auth/firebase_auth ref: cfd9a0e0dc5d2b5157fe0e61999977686fa1ddb0 firebase_auth_platform_interface: git: url: https://github.com/FirebaseExtended/flutterfire path: packages/firebase_auth/firebase_auth_platform_interface ref: cfd9a0e0dc5d2b5157fe0e61999977686fa1ddb0 firebase_auth_web: git: url: https://github.com/FirebaseExtended/flutterfire path: packages/firebase_auth/firebase_auth_web ref: cfd9a0e0dc5d2b5157fe0e61999977686fa1ddb0
ON further investigation there appears to be a greater underlying problem. A slient sleeper maybe.
dependcy_overrides
@cbenhagen suggested above addresses the EEE problem only in somecase, namely application which are not extensively localised.DateFormat('EEE, d MMM yyyy HH:mm:ss', 'en_US');
, whilst this causes the FormatException to go away in application where the Intl package has not been loaded with custom locations it does cause the wrong date to returned.
Thu, 24 Sep 2020 02:19:35 GMT
by calling parse on this payload with the above DateFormat one received back a Dart DateTime, which is in the local time. This is evident by calling .isUtc
which currently always return false, it should be return true. The cause of this EEE, d MMM yyyy HH:mm:ss', 'en_US'
. The correct skeleton format is EEE, dd MMM yyyy HH:mm:ss ZZZ
and probably should be created via the DateFormat constructor as recommended in the documentation for DateFormat.FormatException
error which I am still receiving the tigger appears to be related to calling the .signInWithCredential(fb_auth.GoogleAuthProvider.credential(accessToken: gAuth.accessToken, idToken: gAuth.idToken))
after custom locations are loaded. (You can see these in #3550 and #3533).The Auth code in master is probably fine in situations where app uses a material app and has little or no localaised or support for multiple date formats. I know this issue has bounced around for while in different forms (#3550, #3533, #3266) and can understand why @darshankawar has tried to consoildate some of these issues but we can do and must do better on this stuff.
I am more then willing to help in anyway I can, but this issue needs to get pass this first level triage which it appears to stuck in. I hope someone could response and we can get this sorted. If we are luck it the problem may just be isolate, yet I am worried that it is not.
R.
Thanks for that nice write up.
Also got the issue with firebase_auth: ^0.18.0+1.
It works with this: [dependency overrides]
Well I also have to add that we are currently in the migration and that we haven't yet testet everything. With works I just meant that I could at least log in. Didn't try it out further. Will comment if I see any other issues arising in the future.
I also get the following error using firebase_auth: ^0.18.0+1
and the dependency overrides don't help:
FormatException: Trying to read EEE from Sun, 27 Sep 2020 09:59:17 GMT at position 0
My app is using the new Flutter i18n process based on intl
(see https://github.com/flutter/flutter/issues/41437 ).
The app makes a first Firebase sign-in directly in main()
, no error there. Later, a new sign-in is made from inside the MaterialApp (which did the localization setup). That's when I get the error.
Notes:
firebase_auth_web_user.dart
replacing
final DateFormat _dateFormat = DateFormat('EEE, d MMM yyyy HH:mm:ss', 'en_US');
with
DateFormat get _dateFormat => DateFormat('EEE, d MMM yyyy HH:mm:ss', 'en_US');
So it seems that the _dateFormat
internals get changed, or that intl
does some caching for the _dateFormat
object which later becomes invalid. The second option seems more likely to me since _dateFormat.locale
and _dateFormat.pattern
always give correct values.
I can confirm the situation as described by @knuesel as been observed and reproduced.
A call to locale immediate before the exception is thrown, reports the same locale 'en_US' as the locale in the main where the error does not occur. Basically getting a credential after MaterialApp (with locales set) is loaded is a pre-cursor or contributor to the problem.
Additionally, I can confirm that I have changed the dateFormat Skeleton to EEE, dd MMM yyyy HH:mm:ss ZZZ
(here)[https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_auth/firebase_auth_web/lib/firebase_auth_web_user.dart#L15] in a fork and tested it. But it appears only to be an intermediate solution, in that FormatException: Trying to read EEE from Sun, 27 Sep 2020 09:59:17 GMT at position 0
is still thrown about 30% of the time. So the mystery π continues, it's worth noting that intl appears to work as per documentation and other tests we have for date format and currency appear to work as expected.
*Note the intl implementation we are using strictly follows the current guide, It appears from the above post @knuesel is doing the same.
Worth Increasing the priority of this one.
For the following reasons:
It would be great if @Ehesp @Salakar @helenaford @kirstywilliams or anyone else with some visibility into this issue is travel to reply and. If it's a matter of resources, happy to deep drive this problem to find a fixed provided that it would not be duplication of effort or could conflict with migration efforts.
@darshankawar could please add a 'Needs Attention' to this issue. Are get some acknowledgement of this issue.
We know it's an issue, it's being tracked, just no idea how to fix it properly yet.
The issue is not specific to firebase_auth
, it can be reproduced in a vanilla Flutter app with localization. I filed an issue on the intl
package: https://github.com/dart-lang/i18n/issues/105 .
Meanwhile, editing firebase_auth_web_user.dart
to replace
final DateFormat _dateFormat = DateFormat('EEE, d MMM yyyy HH:mm:ss', 'en_US');
with
DateFormat get _dateFormat => DateFormat('EEE, d MMM yyyy HH:mm:ss', 'en_US');
works well for me...
Let's see if there's acknowledgement of an upstream fix, if nothing seems likely I'll take a look into your solution.
Well, it appears to be flutter localisation issue. https://github.com/dart-lang/i18n/issues/105 Any ideas on how to address this in the short term, besides directly injecting 'en_us' directly into the initializeDateFormattingCustom
are some point during the loading process?
Thanks again @Ehesp and @knuesel for the chasing up of this issue.
I'm currently using this workaround, as suggested in https://github.com/dart-lang/i18n/issues/105 -
import 'package:flutter_localizations/src/utils/date_localizations.dart';
void main() {
loadDateIntlDataIfNotLoaded();
...
}
Hello, I'm currently getting an even more obscure version of this error:
[firebase_auth/unknown] An unknown error occurred: FormatException: Trying to read EEE from null at position 0
This issue is occurring when a User is signing up, however all of the data is being written correctly to our database so it doesn't seem to actually stop any functionality. Is this something in the Firebase Auth code that we can implement a workaround for to avoid this error?
I should also mention that nowhere in our code are we using date formatting in this way, so it definitely seems to be an issue with the package
Hello, I'm currently getting an even more obscure version of this error:
[firebase_auth/unknown] An unknown error occurred: FormatException: Trying to read EEE from null at position 0
This issue is occurring when a User is signing up, however all of the data is being written correctly to our database so it doesn't seem to actually stop any functionality. Is this something in the Firebase Auth code that we can implement a workaround for to avoid this error?
I should also mention that nowhere in our code are we using date formatting in this way, so it definitely seems to be an issue with the package
Hello, I'm experiencing the same bug. As with @APDos, I am not using the package at all at the moment, other than having it as a dependency in pubspec.yaml. Disturbingly, it happens repeatedly as the exception is thrown by [Never throwFormatException(IntlStream stream)] while, I presume, listening to a stream. A killer for debugging.
I've been able to consistently cause this exception only when authenticating.
Experiencing same issue as @APDos and @GerhardMalan, Trying to read EEE from null at position 0, any updates here?
I was able to fix it by doing a null check in _firebase_auth_webuser.dart where it seemed my lastSignInTime was returning null.
For me the issue was being thrown when I was authenticating/creating an account with a cloud function, then trying to sign into that account on the client. Each time I had to re-build my app for it to work. This fix above seems to resolve it for now, not sure why it was returning null in first place though.
Nice fix!
Yes, FirebaseAuth for web, unlike mobile, isn't designed to handle lastSignInTime = null
, which is what happens when you create an account through the Firebase Admin SDK. The Firebase Admin SDK also doesn't expect it to be null.
I assume this is an oversight, but given it has been this way for years, I'm not sure.
I've added a fix for #8313 however I'm not 100% sure this is the same problem as this issue.
Bug report
When I take an action in a Flutter web app (I have no idea what triggers the exception),
firebase_auth_web
throws a format exception.Steps to reproduce
Steps to reproduce the behavior:
firebase_auth
v0.18.0+1
on Flutter web.Click to expand
```dart Error: FormatException: Trying to read EEE from Wed, 08 Apr 2020 14:26:26 GMT at position 0 at Object.throw_ [as throw] (http://localhost:4200/dart_sdk.js:4332:11) at intl._DateFormatPatternField.new.throwFormatException (http://localhost:4200/packages/intl/src/intl_helpers.dart.lib.js:2840:17) at intl._DateFormatPatternField.new.parseField (http://localhost:4200/packages/intl/src/intl_helpers.dart.lib.js:3058:14) at intl._DateFormatPatternField.new.parse (http://localhost:4200/packages/intl/src/intl_helpers.dart.lib.js:2942:12) at intl.DateFormat.new.[_parse] (http://localhost:4200/packages/intl/src/intl_helpers.dart.lib.js:2155:15) at intl.DateFormat.new.parse (http://localhost:4200/packages/intl/src/intl_helpers.dart.lib.js:2116:26) at new firebase_auth_web_user.UserWeb.new (http://localhost:4200/packages/firebase_auth_web/firebase_auth_web_user_credential.dart.lib.js:165:353) at _MapStream.new.Additional context
I am using https://www.gstatic.com/firebasejs/7.19.0/firebase-auth.js.
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` [β] Flutter (Channel dev, 1.22.0-1.0.pre, locale en-150) ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.10.0-45.0.dev Flutter SDK 1.22.0-1.0.pre dependencies: - algolia 0.1.7 [meta http uuid] - async 2.5.0-nullsafety [collection] - cloud_firestore 0.14.0+2 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web] - collection 1.15.0-nullsafety.2 - deep_pick 0.4.3 - file_picker_cross 3.1.1 [flutter file_picker http http_parser file_chooser] - firebase 7.3.0 [http http_parser js] - firebase_auth 0.18.0+1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math] - flutter_markdown 0.4.3 [flutter markdown meta path] - google_sign_in 4.5.3 [google_sign_in_platform_interface flutter meta google_sign_in_web] - http 0.12.2 [http_parser path pedantic] - i18n_extension 1.4.2 [sprintf args flutter] - implicitly_animated_reorderable_list 0.2.3 [flutter async meta] - lumberdash 2.1.1 [meta] - material_design_icons_flutter 4.0.5345 [flutter] - math_expressions 2.0.0 [vector_math] - mime_type 0.3.2 - native_color_picker 1.0.1 [flutter color] - platform_detect 1.4.0 [meta pub_semver] - print_lumberdash 2.1.0 [lumberdash meta] - provider 4.3.2+1 [flutter nested collection] - shared_preferences 0.5.10 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web] - stream_transform 1.2.0 - uuid 2.2.0 [crypto convert] dev dependencies: - flutter_driver 0.0.0 [file json_rpc_2 meta path web_socket_channel vm_service_client webdriver flutter flutter_test fuchsia_remote_debug_protocol archive args async boolean_selector characters charcode clock collection convert crypto fake_async matcher platform process pub_semver source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math] - 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] - mockito 4.1.1 [collection matcher meta test_api] - test 1.16.0-nullsafety.1 [analyzer async boolean_selector coverage http 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] dependency overrides: - file 6.0.0-nullsafety.1 [meta path] transitive dependencies: - _fe_analyzer_shared 7.0.0 [meta] - analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml] - ansicolor 1.0.2 - archive 2.0.13 [crypto args path] - args 1.6.0 - auto_size_text 2.1.0 [flutter] - boolean_selector 2.1.0-nullsafety [source_span string_scanner] - characters 1.1.0-nullsafety.2 - charcode 1.2.0-nullsafety - charts_common 0.9.0 [collection intl logging meta vector_math] - charts_flutter 0.9.0 [charts_common collection flutter intl logging meta] - cli_util 0.2.0 [path] - clock 1.1.0-nullsafety - cloud_firestore_platform_interface 2.0.1 [flutter meta collection firebase_core plugin_platform_interface] - cloud_firestore_web 0.2.0+1 [flutter flutter_web_plugins firebase http_parser meta firebase_core cloud_firestore_platform_interface js] - color 2.1.1 - colorize_lumberdash 2.1.0 [lumberdash meta ansicolor] - convert 2.1.1 [charcode typed_data] - coverage 0.14.0 [args logging package_config path source_maps stack_trace vm_service] - crypto 2.1.5 [collection convert typed_data] - csslib 0.16.2 [source_span] - fake_async 1.1.0-nullsafety [clock collection] - file_chooser 0.1.4 [flutter] - file_picker 1.13.3 [flutter flutter_plugin_android_lifecycle file_picker_platform_interface] - file_picker_platform_interface 1.3.1 [flutter plugin_platform_interface] - firebase_auth_platform_interface 2.0.1 [flutter meta firebase_core plugin_platform_interface] - firebase_auth_web 0.3.0+1 [flutter flutter_web_plugins firebase meta http_parser intl firebase_core firebase_auth_platform_interface js] - firebase_core 0.5.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web] - firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver] - firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js] - firebase_storage 4.0.0 [flutter firebase_core] - flare_dart 2.3.4 - flare_flutter 2.0.6 [flutter flare_dart meta] - flutter_cache_manager 1.4.1 [flutter path_provider uuid http path sqflite pedantic clock file rxdart] - flutter_highlight 0.6.0 [flutter highlight] - flutter_math 0.1.7 [flutter flutter_svg provider tuple meta] - flutter_plugin_android_lifecycle 1.0.8 [flutter] - flutter_svg 0.18.1 [path_drawing xml vector_math meta flutter] - flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math] - fuchsia_remote_debug_protocol 0.0.0 [json_rpc_2 process web_socket_channel flutter_test flutter_driver archive args async boolean_selector charcode clock collection convert crypto fake_async file matcher meta path platform pub_semver source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math vm_service_client webdriver] - get_it 4.0.4 [async meta] - glob 1.2.0 [async collection node_io path pedantic string_scanner] - google_sign_in_platform_interface 1.1.2 [flutter meta quiver] - google_sign_in_web 0.9.1+1 [google_sign_in_platform_interface flutter flutter_web_plugins meta js] - graphs 0.2.0 - highlight 0.6.0 - html 0.14.0+3 [csslib source_span] - http_multi_server 2.2.0 [async] - http_parser 3.1.4 [charcode collection source_span string_scanner typed_data] - intl 0.16.1 [path] - io 0.3.4 [charcode meta path string_scanner] - js 0.6.3-nullsafety - json_rpc_2 2.2.1 [stack_trace stream_channel] - logging 0.11.4 - markdown 2.1.8 [args charcode meta] - matcher 0.12.10-nullsafety [stack_trace] - meta 1.3.0-nullsafety.2 - mime 0.9.7 - nested 0.0.4 [flutter] - node_interop 1.1.1 [js] - node_io 1.1.1 [node_interop path] - node_preamble 1.4.12 - observable_ish 2.1.4 [collection] - package_config 1.9.3 [path charcode] - path 1.8.0-nullsafety - path_drawing 0.4.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.1.4 [vector_math meta] - path_provider 1.6.14 [flutter path_provider_platform_interface path_provider_macos path_provider_linux] - path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 0.0.4+3 [flutter] - path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface] - pedantic 1.10.0-nullsafety - petitparser 3.1.0 [meta] - platform 3.0.0-nullsafety.1 - plugin_platform_interface 1.0.2 [meta] - pool 1.5.0-nullsafety [async stack_trace] - process 4.0.0-nullsafety.1 [file path platform] - pub_semver 1.4.4 [collection] - quiver 2.1.3 [matcher meta] - retry 3.0.1 - rive 0.0.7 [flutter graphs meta] - rxdart 0.24.1 - shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter] - shared_preferences_platform_interface 1.0.4 [meta flutter] - shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta] - shelf 0.7.9 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 2.0.0 [path shelf shelf_static] - shelf_static 0.2.8 [convert http_parser mime path shelf] - shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel] - skeleton_text 1.0.0 [flutter] - sky_engine 0.0.99 - source_map_stack_trace 2.1.0-nullsafety.1 [path stack_trace source_maps] - source_maps 0.10.10-nullsafety [source_span] - source_span 1.8.0-nullsafety [charcode collection path term_glyph] - sprintf 4.1.0 - sqflite 1.3.1 [flutter sqflite_common path] - sqflite_common 1.0.2+1 [synchronized path meta] - stack_trace 1.10.0-nullsafety [path] - stacked 1.7.6 [flutter provider observable_ish] - stream_channel 2.1.0-nullsafety [async] - string_scanner 1.1.0-nullsafety [charcode source_span] - sync_http 0.2.0 - synchronized 2.2.0+2 - term_glyph 1.2.0-nullsafety - test_api 0.2.19-nullsafety [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.3.12-nullsafety.1 [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] - tuple 1.0.3 [quiver] - typed_data 1.3.0-nullsafety.2 [collection] - universal_io 1.0.1 [meta zone_local] - url_launcher 5.5.0 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos] - url_launcher_linux 0.0.1+1 [flutter] - url_launcher_macos 0.0.1+7 [flutter] - url_launcher_platform_interface 1.0.7 [flutter meta plugin_platform_interface] - url_launcher_web 0.1.2+1 [url_launcher_platform_interface platform_detect flutter flutter_web_plugins meta] - vector_math 2.1.0-nullsafety.2 - vm_service 4.2.0 [meta] - vm_service_client 0.2.6+2 [async collection json_rpc_2 pub_semver source_span stack_trace stream_channel web_socket_channel] - watcher 0.9.7+15 [async path pedantic] - web_socket_channel 1.1.0 [async crypto stream_channel] - webdriver 2.1.2 [archive matcher path stack_trace sync_http] - webkit_inspection_protocol 0.7.3 [logging] - websafe_platform 1.0.2 [meta] - xdg_directories 0.1.2 [meta path process] - xml 4.4.1 [collection convert meta petitparser] - yaml 2.2.1 [charcode collection string_scanner source_span] - zone_local 0.1.2 ```