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.72k stars 3.97k forks source link

🐛 [firebase_app_check] [firebase_app_check/unkown] The operation could not be completed. (com.firebase.appCheck-Fehler 0.) #10093

Closed Flajt closed 1 year ago

Flajt commented 1 year ago

Bug report

Title translated to English: The operation/process could not be completed

Describe the bug If I try to run await FirebaseAppCheck.instance.getToken() on an IOS simulator it throws this error.

Steps to reproduce

Steps to reproduce the behavior:

  1. Setup everything as mentioned in the docs
  2. Initialise Firebase and Firebase AppCheck
  3. Run await FirebaseAppCheck.instance.getToken() => get this error

Expected behaviour

  1. Get a debug token
  2. Get a token back

Sample project

Can only provide the link to the whole repo and to the file and method which is repo branch, File


Additional context

Error thrown:

#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
<asynchronous suspension>
#2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:499:43)
<asynchronous suspension>
#3      MethodChannelFirebaseAppCheck.getToken (package:firebase_app_check_platform_interface/src/method_channel/method_channel_firebase_app_check.dart:97:22)
<asynchronous suspension>
#4      AppcheckWrapper.getAppToken (package:decentproof/pages/Integrety/AppCheckWrapper.dart:6:29)
<asynchronous suspension>
#5      ApiKeyManager.updateOrRetriveKey (package:decentproof/pages/Integrety/ApiKeyManager.dart:78:24)
<asynchronous suspension>
#6      _FutureBuilderState._subscribe.<anonymous closure> (package:flutter/src/widgets/async.dart:628:33)
<asynchronous suspension>

It worked at least once on a real device! Switching between development and production in the Runner.entitlements file doesn't seem to do it.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [✓] Flutter (Channel stable, 3.3.5, on macOS 13.0 22A380 darwin-arm, locale de-DE) [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [✓] Xcode - develop for iOS and macOS (Xcode 14.1) [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [!] Android Studio (not installed) [✓] Connected device (2 available) [✓] HTTP Host Availability ! Doctor found issues in 3 categories. ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.18.2 Flutter SDK 3.3.5 decentproof 1.0.0+3 dependencies: - audio_waveforms 0.1.5+1 [flutter] - basic_utils 5.4.2 [http logging json_annotation pointycastle] - chopper 5.1.0 [http logging meta] - cupertino_icons 1.0.5 - dio 4.0.6 [http_parser path] - easy_localization 3.0.1 [flutter shared_preferences intl args path easy_logger flutter_localizations] - file_picker 5.2.2 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_app_check 0.1.1+6 [firebase_app_check_platform_interface firebase_app_check_web firebase_core firebase_core_platform_interface flutter] - firebase_core 2.4.0 [firebase_core_platform_interface firebase_core_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_donation_buttons 0.0.5 [flutter url_launcher simple_icons] - flutter_dotenv 5.0.2 [flutter] - flutter_secure_storage 6.1.0 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta] - http_certificate_pinning 2.0.4 [dio flutter http] - image_picker 0.8.6 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface] - introduction_screen 3.0.2 [flutter dots_indicator collection] - json_annotation 4.7.0 [meta] - nanoid 1.0.0 - native_exif 0.4.0 [flutter intl] - path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - pointycastle 3.6.2 [collection convert js] - share_plus 6.3.0 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi win32] - shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - simple_icons 7.10.0 [flutter] - url_launcher 6.1.7 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] dev dependencies: - build_runner 2.3.2 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - chopper_generator 5.1.0+1 [analyzer build built_collection chopper code_builder dart_style logging meta source_gen] - flutter_launcher_icons 0.11.0 [args checked_yaml cli_util image json_annotation path yaml] - flutter_lints 2.0.1 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - json_serializable 6.5.4 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] - swagger_dart_code_generator 2.8.5 [build path markdown recase json_annotation universal_io collection dart_style code_builder http yaml] transitive dependencies: - _fe_analyzer_shared 50.0.0 [meta] - _flutterfire_internals 1.0.10 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 5.2.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.3.5 [crypto path pointycastle] - args 2.3.1 - async 2.9.0 [collection meta] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.3.1 [analyzer async convert crypto glob logging meta path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 3.1.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.0.10 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml] - build_runner_core 7.2.7 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.4.2 [built_collection collection fixnum meta] - characters 1.2.1 - charcode 1.3.1 - checked_yaml 2.0.1 [json_annotation source_span yaml] - cli_util 0.3.5 [meta path] - clock 1.1.1 - cloud_firestore_platform_interface 5.9.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.1.1 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.3.0 [built_collection built_value collection matcher meta] - collection 1.16.0 - convert 3.1.0 [typed_data] - cross_file 0.3.3+2 [js meta] - crypto 3.0.2 [typed_data] - dart_style 2.2.4 [analyzer args path pub_semver source_span] - dots_indicator 2.1.0 [flutter] - easy_logger 0.0.2 [flutter] - fake_async 1.3.1 [clock collection] - ffi 2.0.1 - file 6.1.4 [meta path] - firebase_app_check_platform_interface 0.0.5+9 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_app_check_web 0.0.7+9 [_flutterfire_internals firebase_app_check_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_core_platform_interface 4.5.2 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.0.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - fixnum 1.0.1 - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - flutter_plugin_android_lifecycle 2.0.7 [flutter] - flutter_secure_storage_linux 1.1.2 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 1.1.2 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.0.1 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.1.1 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js] - flutter_secure_storage_windows 1.1.3 [flutter flutter_secure_storage_platform_interface] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - frontend_server_client 3.2.0 [async path] - glob 2.1.1 [async collection file path string_scanner] - graphs 2.2.0 [collection] - http 0.13.5 [async http_parser meta path] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 3.2.2 [archive meta xml] - image_picker_android 0.8.5+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.1.10 [flutter flutter_web_plugins image_picker_platform_interface] - image_picker_ios 0.8.6+1 [flutter image_picker_platform_interface] - image_picker_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface] - intl 0.17.0 [clock path] - io 1.0.3 [meta path string_scanner] - js 0.6.4 - lints 2.0.1 - logging 1.1.0 - markdown 5.0.0 [args charcode meta] - matcher 0.12.12 [stack_trace] - material_color_utilities 0.1.5 - meta 1.8.0 - mime 1.0.2 - package_config 2.1.0 [path] - path 1.8.2 - path_provider_android 2.0.22 [flutter path_provider_platform_interface] - path_provider_ios 2.0.11 [flutter path_provider_platform_interface] - path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.6 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.5 [flutter platform plugin_platform_interface] - path_provider_windows 2.1.3 [ffi flutter path path_provider_platform_interface win32] - petitparser 5.0.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.3 [meta] - pool 1.5.1 [async stack_trace] - process 4.2.4 [file path platform] - pub_semver 2.1.3 [collection meta] - pubspec_parse 1.2.1 [checked_yaml collection json_annotation pub_semver yaml] - recase 4.1.0 - share_plus_platform_interface 3.2.0 [cross_file flutter meta mime plugin_platform_interface path_provider uuid] - shared_preferences_android 2.0.14 [flutter shared_preferences_platform_interface] - shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface] - shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface] - shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.4.0 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.3 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.2.6 [analyzer async build dart_style glob meta path source_span yaml] - source_helper 1.3.3 [analyzer collection source_gen] - source_span 1.9.0 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - stream_transform 2.1.0 - string_scanner 1.1.1 [source_span] - term_glyph 1.2.1 - test_api 0.4.12 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timing 1.0.0 [json_annotation] - typed_data 1.3.1 [collection] - universal_io 2.0.4 [collection crypto meta typed_data] - url_launcher_android 6.0.22 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.1 [flutter plugin_platform_interface] - url_launcher_web 2.0.13 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface] - uuid 3.0.7 [crypto] - vector_math 2.1.2 - watcher 1.0.2 [async path] - web_socket_channel 2.2.0 [async crypto stream_channel] - win32 3.1.1 [ffi] - xdg_directories 0.2.0+2 [meta path process] - xml 6.1.0 [collection meta petitparser] - yaml 3.1.1 [collection source_span string_scanner] ```

darshankawar commented 1 year ago

This looks similar to https://github.com/firebase/flutterfire/issues/8969 which has been fixed. Please take a look at underlying comments and the fix in it for further resolution in your case. Closing this as duplicate.

Flajt commented 1 year ago

The problem was something different. Apparently the debug flag wasn't passed to the swift compiler. Everything else was fine.

There is a note in the docs, however it doesn't explain where you need to modify the flag. I will link this post so people can see where they need to modify it, in case they have not that much experience with Xcode.