flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[remote_config] internal remote config fetch error

Open rubenvereecken opened this issue 3 years ago • 59 comments

Bug report

Describe the bug Before we upgraded, I've never had this not happen to me. Strangely, my colleague never gets this on his device. Firebase throws every single time we call fetchAndActivate().

Here's the whole stacktrace

Task <C134C25B-109D-43EF-8FC5-CC663AB1CBD7>.<1> finished with error [-999] Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://firebaseremoteconfig.googleapis.com/v1/projects/lessgo-dev/namespaces/firebase:fetch?key=AIzaSyAVEBJyZXrLWDTAHK5j092NMesJ-v1K9FY, NSLocalizedDescription=cancelled, NSErrorFailingURLKey=https://firebaseremoteconfig.googleapis.com/v1/projects/lessgo-dev/namespaces/firebase:fetch?key=AIzaSyAVEBJyZXrLWDTAHK5j092NMesJ-v1K9FY}
7.11.0 - [Firebase/RemoteConfig][I-RCN000026] RCN Fetch failure: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://firebaseremoteconfig.googleapis.com/v1/projects/lessgo-dev/namespaces/firebase:fetch?key=AIzaSyAVEBJyZXrLWDTAHK5j092NMesJ-v1K9FY, NSLocalizedDescription=cancelled, NSErrorFailingURLKey=https://firebaseremoteconfig.googleapis.com/v1/projects/lessgo-dev/namespaces/firebase:fetch?key=AIzaSyAVEBJyZXrLWDTAHK5j092NMesJ-v1K9FY}. No cached config result.
7.11.0 - [Firebase/RemoteConfig][I-RCN000026] RCN Fetch failure. Response http error code: 0
Task <C134C25B-109D-43EF-8FC5-CC663AB1CBD7>.<1> HTTP load failed, 0/0 bytes (error code: -999 [1:89])
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ [firebase_remote_config/internal] internal remote config fetch error
flutter: │
flutter: │ #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
flutter: │ #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
flutter: │ <asynchronous suspension>
flutter: │ #2      MethodChannelFirebaseRemoteConfig.fetchAndActivate (package:firebase_remote_config_platform_interface/src/method_channel/method_channel_firebase_remote_config.dart:145:29)
flutter: │ <asynchronous suspension>
flutter: │ #3      RemoteConfig.fetchAndActivate (package:firebase_remote_config/src/remote_config.dart:86:26)
flutter: │ <asynchronous suspension>
flutter: │ #4      RemoteConfigRepository._fetchRemoteConfig (package:woushe_refactored/src/repositories/remote_config_repository.dart:48:7)
flutter: │ <asynchronous suspension>
flutter: │
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ #0   MethodChannelFirebaseRemoteConfig.fetchAndActivate (package:firebase_remote_config_platform_interface/src/method_channel/method_channel_firebase_remote_config.dart:155:7)
flutter: │ #1   <asynchronous suspension>
flutter: │ #2   RemoteConfig.fetchAndActivate (package:firebase_remote_config/src/remote_config.dart:86:26)
flutter: │ #3   <asynchronous suspension>
flutter: │ #4   RemoteConfigRepository._fetchRemoteConfig (package:woushe_refactored/src/repositories/remote_config_repository.dart:48:7)
flutter: │ #5   <asynchronous suspension>
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ 12:51:54.482 (+0:00:00.502445)

Steps to reproduce

final remoteConfig = RemoteConfig.instance;
await remoteConfig.setConfigSettings(RemoteConfigSettings(
  fetchTimeout: const Duration(seconds: 20),
  minimumFetchInterval: const Duration(minutes: 20),
));
await remoteConfig.fetchAndActivate(); // This bad boy throws

Additional context

This only started happening after we upgraded to Flutter 2 and adopted new Firebase package versions.

Flutter doctor

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    ✗ Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.55.2)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

Flutter dependencies

Click To Expand
Dart SDK 2.12.3
Flutter SDK 2.0.6
woushe_refactored 1.0.42+118

dependencies:
- add_2_calendar 2.1.0 [flutter]
- auto_size_text 3.0.0-nullsafety.0 [flutter]
- cached_network_image 3.0.0 [flutter flutter_cache_manager octo_image]
- chewie 1.0.0 [cupertino_icons flutter video_player wakelock]
- circular_check_box 1.0.4 [flutter]
- collection 1.15.0
- confetti 0.6.0-nullsafety [flutter random_color vector_math]
- contacts_service 0.6.1 [flutter collection quiver]
- cupertino_icons 1.0.3
- date_time_format 2.0.1
- device_info 2.0.0 [flutter device_info_platform_interface]
- devicelocale 0.4.1 [flutter flutter_web_plugins]
- dio 4.0.0 [http_parser path]
- equatable 2.0.0 [collection meta]
- firebase_analytics 8.0.4 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta]
- firebase_auth 1.1.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.1.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.0.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_dynamic_links 2.0.3 [firebase_core flutter]
- firebase_messaging 9.1.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_remote_config 0.10.0-dev.3 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface flutter]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_datetime_picker 1.5.1 [flutter]
- flutter_image_compress 1.0.0 [flutter]
- flutter_libphonenumber 1.0.3 [flutter]
- flutter_linkify 5.0.2 [flutter linkify]
- flutter_markdown 0.6.1 [flutter markdown meta path]
- flutter_native_timezone 1.0.10 [flutter]
- flutter_speed_dial 3.0.5 [flutter]
- font_awesome_flutter 9.0.0 [flutter]
- google_maps_flutter 2.0.3 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- hive 2.0.4 [meta crypto]
- hive_flutter 1.0.0 [flutter hive path_provider path]
- horizontal_blocked_scroll_physics 3.0.0 [flutter pedantic]
- image_cropper 1.4.0 [flutter]
- image_picker 0.7.4 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web]
- in_app_review 2.0.2 [flutter in_app_review_platform_interface]
- in_app_update 2.0.0 [flutter]
- infinite_scroll_pagination 3.0.1 [flutter sliver_tools]
- intl 0.17.0 [clock path]
- intl_phone_number_input 0.7.0+2 [flutter meta libphonenumber_plugin equatable collection]
- introduction_screen 2.1.0 [flutter dots_indicator]
- jiffy 4.1.0 [intl]
- json_serializable 4.1.1 [analyzer build build_config collection json_annotation meta path source_gen]
- location 4.1.1 [flutter location_platform_interface location_web meta]
- logger 1.0.0
- multi_image_picker 4.8.00 [flutter meta]
- open_appstore 1.0.2 [flutter]
- package_info 2.0.0 [flutter]
- path_provider 2.0.1 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- percent_indicator 3.0.1 [flutter]
- permission_handler 7.1.0 [flutter meta permission_handler_platform_interface]
- photo_gallery 1.0.1 [flutter]
- photo_view 0.11.1 [flutter]
- provider 5.0.0 [collection flutter nested]
- pub_semver 2.0.0 [collection]
- pull_to_refresh 1.6.5 [flutter]
- pull_to_refresh_notification 2.0.1 [flutter]
- quiver 3.0.1 [matcher]
- rive 0.7.9 [collection flutter graphs meta]
- rxdart 0.26.0
- shake_flutter 14.1.1 [flutter path]
- share 2.0.1 [meta mime flutter]
- shared_preferences 2.0.5 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- slider_button 0.6.0 [vibration flutter]
- stream_chat_flutter 2.0.0-nullsafety.3 [flutter stream_chat_flutter_core photo_view rxdart scrollable_positioned_list jiffy flutter_svg flutter_portal cached_network_image shimmer flutter_markdown url_launcher video_player chewie file_picker image_picker flutter_keyboard_visibility video_compress visibility_detector http_parser meta lottie substring_highlight flutter_slidable image_gallery_saver share_plus photo_manager ezanimation synchronized dio characters path_provider video_thumbnail collection]
- timeago 3.0.2
- url_launcher 6.0.3 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web]
- validators 3.0.0
- video_compress 3.0.0 [flutter]
- video_player 2.1.1 [meta video_player_platform_interface video_player_web flutter flutter_test]
- visibility_detector 0.2.0 [flutter]
- wechat_assets_picker 5.5.0 [flutter extended_image photo_manager provider video_player]

dev dependencies:
- hive_generator 1.1.0 [build source_gen hive analyzer source_helper]

dependency overrides:
- graphs 1.0.0

transitive dependencies:
- _fe_analyzer_shared 21.0.0 [meta]
- analyzer 1.5.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml pedantic]
- archive 3.1.2 [crypto path]
- args 2.1.0
- async 2.5.0 [collection]
- boolean_selector 2.1.0 [source_span string_scanner]
- build 2.0.1 [analyzer async convert crypto glob logging meta path]
- build_config 1.0.0 [checked_yaml json_annotation path pubspec_parse yaml]
- characters 1.1.0
- charcode 1.2.0
- checked_yaml 2.0.1 [json_annotation source_span yaml]
- cli_util 0.3.0 [meta path]
- clock 1.1.0
- convert 3.0.0 [typed_data]
- crypto 3.0.1 [collection typed_data]
- dart_style 2.0.1 [analyzer args path pub_semver source_span]
- device_info_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- dots_indicator 2.0.0 [flutter]
- extended_image 4.1.0 [extended_image_library flutter meta]
- extended_image_library 3.1.0 [crypto flutter http_client_helper path path_provider]
- ezanimation 0.5.0 [flutter]
- fake_async 1.2.0 [clock collection]
- ffi 1.0.0
- file 6.0.0 [meta path]
- file_picker 3.0.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface]
- firebase 9.0.1 [http http_parser js]
- firebase_analytics_platform_interface 2.0.1 [flutter meta]
- firebase_analytics_web 0.3.0+1 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta]
- firebase_auth_platform_interface 4.2.2 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 1.1.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.0.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.0.3 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 2.1.4 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 1.0.7 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- firebase_remote_config_platform_interface 0.3.0-dev.3 [firebase_core flutter meta plugin_platform_interface]
- flutter_blurhash 0.6.0 [flutter meta pedantic]
- flutter_cache_manager 3.0.1 [clock collection file flutter http image path path_provider pedantic rxdart sqflite uuid]
- flutter_keyboard_visibility 5.0.1 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter]
- flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface]
- flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter]
- flutter_plugin_android_lifecycle 2.0.1 [flutter]
- flutter_portal 0.4.0 [flutter]
- flutter_slidable 0.6.0 [flutter]
- flutter_svg 0.22.0 [flutter meta path_drawing vector_math xml]
- 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]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- freezed_annotation 0.14.1 [collection json_annotation meta]
- glob 2.0.1 [async collection file path pedantic string_scanner]
- google_maps_flutter_platform_interface 2.0.4 [flutter meta plugin_platform_interface stream_transform collection]
- http 0.13.3 [async http_parser meta path pedantic]
- http_client_helper 2.0.2 [http]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image 3.0.2 [archive meta xml]
- image_gallery_saver 1.6.9 [flutter]
- image_picker_for_web 2.0.0 [image_picker_platform_interface meta flutter flutter_web_plugins]
- image_picker_platform_interface 2.1.0 [flutter meta http plugin_platform_interface]
- in_app_review_platform_interface 2.0.2 [flutter url_launcher plugin_platform_interface platform]
- js 0.6.3
- json_annotation 4.0.1
- libphonenumber 2.0.0 [flutter meta]
- libphonenumber_platform_interface 0.3.1 [flutter plugin_platform_interface]
- libphonenumber_plugin 0.2.3 [flutter flutter_web_plugins libphonenumber_platform_interface libphonenumber_web libphonenumber]
- libphonenumber_web 0.2.0+1 [flutter flutter_web_plugins js libphonenumber_platform_interface]
- linkify 4.0.0
- location_platform_interface 2.1.0 [flutter meta plugin_platform_interface]
- location_web 3.0.0 [flutter flutter_web_plugins http_parser js location_platform_interface meta]
- logging 1.0.1
- lottie 1.0.1 [archive characters charcode collection flutter logging meta path vector_math]
- markdown 4.0.0 [args charcode meta]
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- mime 1.0.0
- nested 1.0.0 [flutter]
- octo_image 1.0.0+1 [flutter flutter_blurhash]
- package_config 2.0.0 [path]
- path 1.8.0
- path_drawing 0.5.1 [vector_math meta path_parsing flutter]
- path_parsing 0.2.1 [vector_math meta]
- path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 2.0.0 [flutter]
- path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface]
- path_provider_windows 2.0.1 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.11.0
- permission_handler_platform_interface 3.3.0 [flutter meta plugin_platform_interface]
- petitparser 4.1.0 [meta]
- photo_manager 1.1.6 [flutter]
- platform 3.0.0
- plugin_platform_interface 2.0.0 [meta]
- process 4.0.0 [file path platform]
- pubspec_parse 1.0.0 [checked_yaml collection json_annotation pub_semver yaml]
- random_color 1.0.6-nullsafety [flutter]
- scrollable_positioned_list 0.2.0-nullsafety.0 [flutter collection]
- share_plus 2.0.3 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]
- share_plus_linux 2.0.1 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 2.0.1 [share_plus_platform_interface flutter]
- share_plus_platform_interface 2.0.1 [flutter meta mime plugin_platform_interface]
- share_plus_web 2.0.1 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 2.0.1 [share_plus_platform_interface flutter meta url_launcher]
- shared_preferences_linux 2.0.0 [flutter file meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 2.0.0 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.0 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 2.0.0 [shared_preferences_platform_interface flutter file meta path path_provider_platform_interface path_provider_windows]
- shimmer 2.0.0 [flutter]
- sky_engine 0.0.99
- sliver_tools 0.2.2 [flutter]
- source_gen 1.0.0 [analyzer async build dart_style glob meta path pedantic source_span]
- source_helper 1.1.0 [analyzer collection source_gen]
- source_span 1.8.0 [charcode collection path term_glyph]
- sqflite 2.0.0+3 [flutter sqflite_common path]
- sqflite_common 2.0.0+2 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_chat 2.0.0-nullsafety.1 [async collection dio equatable freezed_annotation http_parser json_annotation logging meta mime rxdart uuid web_socket_channel]
- stream_chat_flutter_core 2.0.0-nullsafety.2 [collection flutter meta rxdart stream_chat]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- substring_highlight 1.0.26 [flutter]
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- url_launcher_linux 2.0.0 [flutter]
- url_launcher_macos 2.0.0 [flutter]
- url_launcher_platform_interface 2.0.2 [flutter plugin_platform_interface]
- url_launcher_web 2.0.0 [url_launcher_platform_interface meta flutter flutter_web_plugins]
- url_launcher_windows 2.0.0 [flutter]
- uuid 3.0.4 [crypto]
- vector_math 2.1.0
- vibration 1.7.1 [flutter vibration_web]
- vibration_web 1.6.2 [flutter flutter_web_plugins]
- video_player_platform_interface 4.1.0 [flutter meta flutter_test]
- video_player_web 2.0.0 [flutter flutter_web_plugins meta video_player_platform_interface]
- video_thumbnail 0.3.3 [flutter]
- wakelock 0.4.0 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web]
- wakelock_macos 0.1.0 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.2.0 [flutter meta]
- wakelock_web 0.2.0 [flutter flutter_web_plugins js wakelock_platform_interface]
- watcher 1.0.0 [async path pedantic]
- web_socket_channel 2.1.0 [async crypto stream_channel]
- win32 2.0.5 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.1.0 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]

rubenvereecken avatar May 20 '21 12:05 rubenvereecken

This seems to always happen on a Mac for me.

TheJulianJES avatar May 21 '21 04:05 TheJulianJES

@rubenvereecken I tried the official plugin repo on latest stable (2.2.0) and with below dependencies, with which the fetchAndActivate() worked properly:

Screenshot 2021-05-21 at 12 59 20 PM
  firebase_core: ^1.1.0
  firebase_remote_config: ^0.10.0-dev.4
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.0, on Mac OS X 10.15.4 19E2269 darwin-x64,
    locale en-GB)
    • Flutter version 2.2.0 at /Users/dhs/documents/fluttersdk/flutter
    • Framework revision b22742018b (5 days ago), 2021-05-14 19:12:57 -0700
    • Engine revision a9d88a4d18
    • Dart version 2.13.0

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.55.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (3 available)
    • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
      • iOS 14.4.1
    • macOS (desktop)           • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)              • chrome                                   •
      web-javascript • Google Chrome 90.0.4430.212

! Doctor found issues in 1 category.


darshankawar avatar May 21 '21 07:05 darshankawar

Not much I can add to that @darshankawar, like I said, it works 100% of the time on some devices, and breaks 100% of the time on other devices. It might have something to do with iOS persisting more than is good for it despite reinstalls (maybe from an old version of remote_config).

rubenvereecken avatar May 21 '21 09:05 rubenvereecken

This is weird. Maybe somehow the requests are going more than once and previous request is getting cancelled by any chance, but this is just my guess.

Keeping this open for further investigation, as I am unable to replicate it.

darshankawar avatar May 21 '21 10:05 darshankawar

I was able to reproduce this with.

[✓] Flutter (Channel stable, 2.0.6, on macOS 11.2.3 20D91 darwin-x64, locale en-TR)

and 

firebase_remote_config: ^0.10.0

Here are steps to reproduce:

  • Initialize the app with remote config
  • Give it a custom RemoteConfigSettings e.g.
RemoteConfigSettings(
  fetchTimeout: const Duration(seconds: 10),
  minimumFetchInterval: const Duration(minutes: 5),
),
  • Run the application on macOS as a Desktop application
  • Wait for 5 minutes (or as long as your minimumFetchInterval)
  • Close the application
  • Reopen the app Actual:
  • It gives the error. Expected:
  • It should fetch the latest version of the information.

salihgueler avatar May 26 '21 14:05 salihgueler

Happens to me on iOS with

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.1 20C69 darwin-x64, locale en)

and

firebase_remote_config: ^0.10.0+2

If I remove RemoteConfigSettings from the initialization, it works. If I put it back in the code, it throws the exception again. This is the native iOS log:

8.0.0 - [Firebase/RemoteConfig][I-RCN000026] RCN Fetch failure: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://firebaseremoteconfig.googleapis.com/v1/projects/lumen-c6690/namespaces/firebase:fetch?key=AIzaSyCv1tpL0Clk_tLSdmpq9HdVGPOknkRVBZU, NSErrorFailingURLKey=https://firebaseremoteconfig.googleapis.com/v1/projects/lumen-c6690/namespaces/firebase:fetch?key=AIzaSyCv1tpL0Clk_tLSdmpq9HdVGPOknkRVBZU, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <03EE4952-323C-4A08-B376-9091F1DA68E3>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <03EE4952-323C-4A08-B376-9091F1DA68E3>.<1>, NSLocalizedDescription=cancelled}. No cached config result.
8.0.0 - [Firebase/RemoteConfig][I-RCN000026] RCN Fetch failure. Response http error code: 0

avi-mastov avatar Jul 12 '21 11:07 avi-mastov

Failed to submit an app to app store because on iPad it crashes with same error while tested by apple testers. Not crashing on my side. :(

vytautas-pranskunas- avatar Jul 27 '21 08:07 vytautas-pranskunas-

I had a similar issue which I managed to solve when I was trying to wait for both futures simultaneously.

final List<Future<void>> setupFutures = [
  RemoteConfig.instance.setConfigSettings(
      RemoteConfigSettings(
      fetchTimeout: Duration(seconds: 60),
      minimumFetchInterval: Duration(seconds: 0),
    ),
  );
  RemoteConfig.instance.fetchAndActivate(),
];

await Future.wait(setupFutures);

Awaiting RemoteConfig.instance.setConfigSettings before calling RemoteConfig.instance.fetchAndActivate solved my issue.

@rubenvereecken I see that you are already doing this without succeeding but it might help someone else stumbling upon this issue.

Kal-Elx avatar Jul 27 '21 10:07 Kal-Elx

I abandoned remote config and added configs to my DB

vytautas-pranskunas- avatar Jul 27 '21 10:07 vytautas-pranskunas-

this just reproduced on CI

lesnitsky avatar Aug 04 '21 10:08 lesnitsky

It's honestly pretty wild that this package does this one very simple thing like managing a simple key-value dcument, yet this main use case hasn't been working for multiple months.

rubenvereecken avatar Aug 04 '21 21:08 rubenvereecken

I had the same problem, and solved by checking the API KEY at the file GoogleService-info.plist

I restricted the Firebase API to IOS, but the GoogleService-info.plist was with the Android app API KEY.

ligoriofc avatar Aug 09 '21 23:08 ligoriofc

A concrete cause of the "internal error" in case of CI failures was keychain sharing capability, so make sure to add it with com.firebase group

#6748 also propagates an underlying error description up to the dart code, so please, share those in case keychain sharing capability doesn't fix your problem

lesnitsky avatar Aug 12 '21 08:08 lesnitsky

@lesnitsky why should we add our apps to the com.firebase group? That sounds like a security risk.

I managed to work around this error by doing the following:

await RemoteConfig.instance.activate();
// Only fetch after a delay to prevent an internal bug from occurring
// See https://github.com/FirebaseExtended/flutterfire/issues/6196
await Future.delayed(const Duration(seconds: 1));
await RemoteConfig.instance.fetchAndActivate();

Not sure how this would help but somehow adding the delay there fixes the issue

Kavantix avatar Sep 27 '21 10:09 Kavantix

@Kavantix macOS apps prompt for keychain access (firebase SDK reads tokens from keychain). If you're ok with this behavior – no need to add a capability

your workaround doesn't seem to be related to the keychain at all

Also, it's hard to judge what exactly the issue is in each specific case because the error from native wasn't propagating before #6748 was merged.

My comment was related to a CI failure, other cases may have completely different root causes

lesnitsky avatar Sep 27 '21 11:09 lesnitsky

@lesnitsky exactly it is not related to KeyChain, I'm experiencing it on iOS and android (not using macos for this app)

Kavantix avatar Sep 27 '21 11:09 Kavantix

@Kavantix what version are you on?

lesnitsky avatar Sep 27 '21 11:09 lesnitsky

I'm stuck on 0.10.0-dev.3 atm, need to upgrade some things

Kavantix avatar Sep 27 '21 11:09 Kavantix

I can see the native error though, probably printed by the iOS sdk:

7.11.0 - [Firebase/RemoteConfig][I-RCN000026] RCN Fetch failure: Error Domain=NSURLErrorDomain Code=-999 "canceled" UserInfo={NSErrorFailingURLStringKey=https://firebaseremoteconfig.googleapis.com/v1/projects/{redacted}/namespaces/firebase:fetch?key={redacted}, NSErrorFailingURLKey=https://firebaseremoteconfig.googleapis.com/v1/projects/{redacted}/namespaces/firebase:fetch?key={redacted}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <{redacted}>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <{redacted}>.<1>, NSLocalizedDescription=canceled}. No cached config result.
7.11.0 - [Firebase/RemoteConfig][I-RCN000026] RCN Fetch failure. Response http error code: 0

That is also why I tried the delay in the first place, looks like a timing issue to me

Kavantix avatar Sep 27 '21 11:09 Kavantix

I made a mistake and ran fetchAndActivate twice in parallel which caused this issue. Maybe better error message or no-op on second call might help? This might explain why some people resolved this issue by adding a delay.

Repro code:

final config = RemoteConfig.instance;
await Future.wait([
  config.fetchAndActivate(),
  config.fetchAndActivate(),
]);

coldstar96 avatar Nov 17 '21 05:11 coldstar96

I have the same problem. Any solution?

VagnerWillian avatar Nov 22 '21 06:11 VagnerWillian

any updates?

ariefwijaya avatar Nov 28 '21 01:11 ariefwijaya

any updates?

VagnerWillian avatar Dec 15 '21 21:12 VagnerWillian

The (desperate) work-around by @Kavantix seems to point at a potential fix in the package.

@darshankawar @maheshmnj care to take a look?

rubenvereecken avatar Jan 31 '22 12:01 rubenvereecken

This issue has passed primary triage and has been labeled for further investigation. Let us wait for the secondary triage's input.

maheshj01 avatar Feb 07 '22 06:02 maheshj01

I run into the same issue in one of my apps, the workaround that fixed it was this:

await InternetAddress.lookup('google.com');
await _remoteConfig.fetchAndActivate();

Also, adding a delay as suggested by @Kavantix works, not sure why but this is still reproducible in v2.0.0 only on iOS, works well on Android.

pr-Mais avatar Feb 15 '22 09:02 pr-Mais

In my case, it was solved by checking the test device network connection.

gonft avatar Feb 15 '22 12:02 gonft

I had a similar issue which I managed to solve when I was trying to wait for both futures simultaneously.

final List<Future<void>> setupFutures = [
  RemoteConfig.instance.setConfigSettings(
      RemoteConfigSettings(
      fetchTimeout: Duration(seconds: 60),
      minimumFetchInterval: Duration(seconds: 0),
    ),
  );
  RemoteConfig.instance.fetchAndActivate(),
];

await Future.wait(setupFutures);

Awaiting RemoteConfig.instance.setConfigSettings before calling RemoteConfig.instance.fetchAndActivate solved my issue.

@rubenvereecken I see that you are already doing this without succeeding but it might help someone else stumbling upon this issue.

This is not working on IOS

bhanuka96 avatar Feb 19 '22 08:02 bhanuka96

@darshankawar is there a solid workaround for this or an ETA for this fix? if it causes ios first install to fail to get remote config values then it would mean firebase remote config won't work for us at all like @lesnitsky but surely there is a reliable fix like @Kavantix etc mentioned. i tried both lookup google.com and ensureinitialized and I'm not having much luck so far.

neiljaywarner avatar Feb 23 '22 00:02 neiljaywarner

I had a similar issue which I managed to solve when I was trying to wait for both futures simultaneously.

final List<Future<void>> setupFutures = [
  RemoteConfig.instance.setConfigSettings(
      RemoteConfigSettings(
      fetchTimeout: Duration(seconds: 60),
      minimumFetchInterval: Duration(seconds: 0),
    ),
  );
  RemoteConfig.instance.fetchAndActivate(),
];

await Future.wait(setupFutures);

Awaiting RemoteConfig.instance.setConfigSettings before calling RemoteConfig.instance.fetchAndActivate solved my issue.

@rubenvereecken I see that you are already doing this without succeeding but it might help someone else stumbling upon this issue.

Thank you so much!

In my case it wasn't as obvious, but the same issue.

I was calling setConfigSettings in the init method of my whole app, while calling fetchAndActivate() in another init method of the first route that's loaded. That would cause the same race condition and this completely unreadable error message.

ciriousjoker avatar Feb 23 '22 05:02 ciriousjoker