Closed radvansky-tomas closed 2 years ago
Hi @radvansky-tomas
Could you please provide your flutter doctor -v
and flutter pub deps -- --style=compact
?
Thank you
@markusaksli-nc is this your pre-defined response ? this error is most likely issue on firebase tools OR flutter fire plugin, not really to my current flutter installation.
I am running stable flutter...(same as 2 days ago)
[β] Flutter (Channel stable, 2.2.2, on macOS 11.3.1 20E241 darwin-arm, locale en-NZ)
β’ Flutter version 2.2.2 at /Users/tomasradvansky/fvm/versions/stable
β’ Framework revision d79295af24 (4 weeks ago), 2021-06-11 08:56:01 -0700
β’ Engine revision 91c9fc8fe0
β’ Dart version 2.13.3
[β] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
β’ Android SDK at /Users/tomasradvansky/Library/Android/sdk
β’ Platform android-30, build-tools 30.0.3
β’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
β’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
β’ All Android licenses accepted.
[β] Xcode - develop for iOS and macOS
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ Xcode 12.5, Build version 12E262
β’ CocoaPods version 1.10.1
[β] Chrome - develop for the web
β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[β] Android Studio (version 4.2)
β’ Android Studio at /Applications/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 11.0.8+10-b944.6916264)
[β] VS Code (version 1.58.0)
β’ VS Code at /Applications/Visual Studio Code.app/Contents
β’ Flutter extension version 3.24.0
[β] Connected device (2 available)
β’ macOS (desktop) β’ macos β’ darwin-arm64 β’ macOS 11.3.1 20E241 darwin-arm
β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 91.0.4472.114
This is just basic information we need on each issue to know the context of the report. Otherwise, we don't know which storage version you are using on which device with which flutter version, etc. If the issue is related to the internally managed version of the native Firebase SDK we need to know your firebase_core
version as well.
This is why we have an issue template and why the first thing I have to ask is that you provide this information if you ignore the template (please don't).
Since this seems like it could be caused by firebase tools could you also mention which version you are using?
I am using last versions of everything,
firebase tools 9.16.0
flutter pub deps -- --style=compact
Dart SDK 2.13.3
Flutter SDK 2.2.2
art_is_heart 1.0.2+68
dependencies:
- algolia 1.0.1 [meta http uuid]
- app_settings 4.1.0 [flutter]
- beamer 0.14.0 [flutter flutter_web_plugins]
- camera 0.8.1+1 [flutter camera_platform_interface pedantic quiver]
- cloud_firestore 2.3.0 [cloud_firestore_platform_interface cloud_firestore_web firebase_core firebase_core_platform_interface flutter meta]
- cloud_functions 2.0.0 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
- cupertino_icons 1.0.2
- easy_localization 3.0.0 [flutter shared_preferences intl args path easy_logger flutter_localizations]
- extended_image 4.0.1 [extended_image_library flutter meta]
- firebase_analytics 8.1.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta]
- firebase_auth 2.0.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.3.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.0.7 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_dynamic_links 2.0.6 [firebase_core flutter]
- firebase_in_app_messaging 0.5.0+6 [firebase_core flutter meta]
- firebase_storage 9.0.0 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
- fl_chart 0.36.2 [flutter equatable pedantic]
- flash 1.5.2 [flutter]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_carousel_slider 1.0.8 [flutter]
- flutter_easyrefresh 2.2.1 [flutter]
- flutter_exif_rotation 0.4.1 [flutter]
- flutter_html 2.0.0-nullsafety.0 [html csslib css_colors flutter_layout_grid video_player chewie webview_flutter chewie_audio flutter_svg flutter]
- flutter_inappwebview 5.3.2 [flutter]
- flutter_login_facebook 1.0.1 [flutter list_ext]
- flutter_offline 2.0.0 [flutter connectivity wifi_info_flutter]
- flutter_secure_storage 4.2.0 [meta flutter]
- flutter_sizer 1.0.3 [flutter]
- flutter_slidable 0.6.0 [flutter]
- flutter_svg 0.22.0 [flutter meta path_drawing vector_math xml]
- flutter_svprogresshud 0.0.7 [flutter]
- flutter_typeahead 3.1.1 [flutter flutter_keyboard_visibility]
- font_awesome_flutter 9.0.0 [flutter]
- google_maps_flutter 2.0.3 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- google_ml_vision 0.0.6 [flutter]
- google_sign_in 5.0.2 [google_sign_in_platform_interface google_sign_in_web flutter meta]
- http 0.13.3 [async http_parser meta path pedantic]
- image 3.0.2 [archive meta xml]
- image_picker 0.8.1+3 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface]
- lazy_load_scrollview 1.3.0 [flutter]
- maps_launcher 2.0.0 [flutter flutter_web_plugins url_launcher]
- page_indicator 0.4.1 [flutter]
- photo_view 0.11.1 [flutter]
- pluto_grid 2.3.0 [flutter intl rxdart linked_scroll_controller pluto_filtered_list collection]
- provider 5.0.0 [collection flutter nested]
- reactive_forms 10.2.0 [flutter intl]
- retry 3.1.0
- share_extend 2.0.0 [meta flutter]
- sign_in_with_apple 3.0.0 [flutter meta]
- the_validator 2.0.0 [flutter]
- timeago 3.0.2
- universal_platform 1.0.0+1
- url_launcher 6.0.3 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web]
- waterfall_flow 3.0.1 [collection extended_list_library flutter]
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]
dependency overrides:
- beamer 0.14.0 [flutter flutter_web_plugins]
- flutter_sizer 1.0.3 [flutter]
- flutter_svg 0.22.0 [flutter meta path_drawing vector_math xml]
transitive dependencies:
- archive 3.1.2 [crypto path]
- args 2.1.1
- async 2.6.1 [meta collection]
- boolean_selector 2.1.0 [source_span string_scanner]
- camera_platform_interface 2.0.1 [flutter meta plugin_platform_interface cross_file stream_transform]
- characters 1.1.0
- charcode 1.2.0
- chewie 1.0.0 [cupertino_icons flutter video_player wakelock]
- chewie_audio 1.2.0 [cupertino_icons flutter video_player]
- clock 1.1.0
- cloud_firestore_platform_interface 5.2.0 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.2.0 [cloud_firestore_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- cloud_functions_platform_interface 5.0.7 [firebase_core flutter meta plugin_platform_interface]
- cloud_functions_web 4.0.9 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.15.0
- connectivity 3.0.6 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web]
- connectivity_for_web 0.4.0 [connectivity_platform_interface flutter_web_plugins flutter]
- connectivity_macos 0.2.0 [flutter]
- connectivity_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- cross_file 0.3.1+3 [flutter meta]
- crypto 3.0.1 [collection typed_data]
- css_colors 1.1.1 [flutter]
- csslib 0.17.0 [source_span]
- easy_logger 0.0.2 [flutter]
- equatable 2.0.3 [collection meta]
- extended_image_library 3.1.0 [crypto flutter http_client_helper path path_provider]
- extended_list_library 3.0.0 [flutter]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- 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 5.0.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 2.0.0 [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.1.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.0.6 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_platform_interface 3.0.0 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 2.0.0 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]
- flutter_keyboard_visibility 5.0.2 [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_layout_grid 1.0.3 [flutter collection meta quiver]
- flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math]
- flutter_plugin_android_lifecycle 2.0.2 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- google_maps_flutter_platform_interface 2.1.0 [collection flutter meta plugin_platform_interface stream_transform]
- google_sign_in_platform_interface 2.0.1 [flutter meta quiver]
- google_sign_in_web 0.10.0 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- html 0.15.0 [csslib source_span]
- http_client_helper 2.0.2 [http]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image_picker_for_web 2.1.0 [flutter flutter_web_plugins image_picker_platform_interface meta]
- image_picker_platform_interface 2.2.0 [flutter http meta plugin_platform_interface cross_file]
- intl 0.17.0 [clock path]
- js 0.6.3
- linked_scroll_controller 0.2.0 [flutter]
- list_ext 1.0.2 [quiver collection]
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- nested 1.0.0 [flutter]
- 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 2.0.2 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- 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.1
- petitparser 4.1.0 [meta]
- platform 3.0.0
- plugin_platform_interface 2.0.1 [meta]
- pluto_filtered_list 0.2.0 [collection]
- process 4.2.1 [file path platform]
- quiver 3.0.1 [matcher]
- rxdart 0.27.1
- shared_preferences 2.0.6 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- 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]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test_api 0.3.0 [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.4 [flutter plugin_platform_interface]
- url_launcher_web 2.0.1 [flutter flutter_web_plugins meta url_launcher_platform_interface]
- url_launcher_windows 2.0.0 [flutter]
- uuid 3.0.4 [crypto]
- vector_math 2.1.0
- video_player 2.1.10 [flutter flutter_test meta video_player_platform_interface video_player_web]
- video_player_platform_interface 4.1.0 [flutter meta flutter_test]
- video_player_web 2.0.1 [flutter flutter_web_plugins meta video_player_platform_interface]
- wakelock 0.4.0 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web]
- wakelock_macos 0.1.0+1 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.2.1+1 [flutter meta]
- wakelock_web 0.2.0+1 [flutter flutter_web_plugins js wakelock_platform_interface]
- webview_flutter 2.0.9 [flutter]
- wifi_info_flutter 2.0.2 [flutter wifi_info_flutter_platform_interface]
- wifi_info_flutter_platform_interface 2.0.1 [plugin_platform_interface flutter]
- win32 2.2.5 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.1.2 [collection meta petitparser]
I tried this but didn't see a crash. Have you tried uploading from different devices (web, android, etc)?
@markusaksli-nc
I downgraded firebase tools to 9.14.0 and upgraded flutter to 2.2.3
Android works as expected
iOS - Insecure fetch request has a scheme (http) not found in fetcher allowedInsecureSchemes
Which to me is related to https://github.com/firebase/firebase-ios-sdk/issues/7342
Basically http requests should be allowed when using emulator as if you want to use "Real device" and connect to locally hosted emulator you have to pass IP address + port of your computer (with emulator) and connect to it via HTTP and local network.
All those things are allowed in PLIST and works fine for other modules (such as Auth/Firestore), but I think that generic class "fetcher" needs to be configured for "InsecureSchemes"
Its using GTMSessionFetcher.m with this check
if (!allowRequest) {
// Check for localhost requests. Security checks only occur for non-https requests, so
// this check won't happen for an https request to localhost.
BOOL isLocalhostRequest =
(host.length == 0 && [fetchRequestURL isFileURL]) || IsLocalhost(host);
if (isLocalhostRequest) {
if (self.allowLocalhostRequest) {
allowRequest = YES;
} else {
GTMSESSION_ASSERT_DEBUG(NO,
@"Fetch request for localhost but fetcher"
@" allowLocalhostRequest is not set: %@",
fetchRequestURL);
}
} else {
GTMSESSION_ASSERT_DEBUG(NO,
@"Insecure fetch request has a scheme (%@)"
@" not found in fetcher allowedInsecureSchemes (%@): %@",
requestScheme, _allowedInsecureSchemes ?: @" @[] ",
fetchRequestURL);
}
}
So I've added
[fetcherService setAllowedInsecureSchemes:@[@"http"]];
To FIRStorage.m
+ (GTMSessionFetcherService *)fetcherServiceForApp:(FIRApp *)app
bucket:(NSString *)bucket
auth:(nullable id<FIRAuthInterop>)auth
appCheck:(nullable id<FIRAppCheckInterop>)appCheck {
@synchronized(_fetcherServiceMap) {
NSMutableDictionary *bucketMap = _fetcherServiceMap[app.name];
if (!bucketMap) {
bucketMap = [[NSMutableDictionary alloc] init];
_fetcherServiceMap[app.name] = bucketMap;
}
GTMSessionFetcherService *fetcherService = bucketMap[bucket];
if (!fetcherService) {
fetcherService = [[GTMSessionFetcherService alloc] init];
[fetcherService setRetryEnabled:YES];
[fetcherService setRetryBlock:_retryWhenOffline];
[fetcherService setAllowLocalhostRequest:YES];
[fetcherService setAllowedInsecureSchemes:@[@"http"]];
FIRStorageTokenAuthorizer *authorizer =
[[FIRStorageTokenAuthorizer alloc] initWithGoogleAppID:app.options.googleAppID
fetcherService:fetcherService
authProvider:auth
appCheck:appCheck];
[fetcherService setAuthorizer:authorizer];
bucketMap[bucket] = fetcherService;
}
return fetcherService;
}
}
Which resolved connection issues from iOS and as mentioned above, caused crash of emulator with
] [2021-07-15T07:14:59.560Z] Error: ENOENT: no such file or directory, unlink '/var/folders/3h/xyph78j90xn59smt_76225m40000gn/T/firebase/storage/blobs/25c879c6-0d9b-4261-9900-525370cac40d_b_default-bucket_o_profiles%2FgpfY28CPn9fQSIZTUh93HAAYtJn4.jpg'
at Object.unlinkSync (node:fs:1263:3)
at Persistence.deleteFile (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/lib/emulator/storage/files.js:478:18)
at StorageLayer.cancelUpload (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/lib/emulator/storage/files.js:152:27)
at handleUpload (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/lib/emulator/storage/apis/firebase.js:366:45)
at /Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/lib/emulator/storage/apis/firebase.js:443:24
at Layer.handle [as handle_request] (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/layer.js:95:5)
at /Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/index.js:281:22
at param (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/index.js:354:14)
at param (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/index.js:365:14)
at param (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/index.js:365:14)
at Function.process_params (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/index.js:410:3)
at next (/Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/node_modules/express/lib/router/index.js:275:10)
at /Users/tomasradvansky/.nvm/versions/node/v15.14.0/lib/node_modules/firebase-tools/lib/emulator/storage/apis/firebase.js:89:9
[error]
[error] Error: An unexpected error has occurred.
So this only occurs with real iOS devices?
You can probably simulate it from other computer...but its happening to app running in iOS accessing firebase emulator on address different than localhost.
But yes common use case it having emulator running and trying to use real device.
I havent tried it from simulator, as its using camera to upload file (not available on iOS Simulator)
Haven't been able to establish a remote connection due to some permission issues but I'll label this for now
Found underlaying issue with storage.rules: https://github.com/firebase/firebase-tools/issues/3550
Hey folks, this issue has now been resolved: https://github.com/firebase/firebase-tools/issues/3550. You can now upgrade to the latest firebase CLI by running npm install -g firebase-tools
for the latest Storage emulator.
On file upload to firebase storage emulator, emulator immediately crashes
In logs:
Related/Caused by https://github.com/firebase/firebase-tools/issues/3550