Skip to content

Generate dummy ServiceWorker in development mode to avoid misleading errors #49479

@sanekyy

Description

@sanekyy

Steps to Reproduce

Hello. I want to add web support to my existing project. To do this I executed flutter create . which created web dir. Then I just executed flutter run -d chrome and error occured.

Expected results: Flutter Web work
Actual results: Flutter Web doesn't work with error in browser console:

Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope with script flutter_service_worker.js: A bad HTTP response code (404) was received when fetching the script.

image

Logs
flutter run -d chrome --verbose
[  +24 ms] executing: [/Users/sanekyy/Programs/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +33 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 5e1000cd8540a6305df5a999d4dcb0b59fe3c66a
[        ] executing: [/Users/sanekyy/Programs/flutter/] git describe --match v*.*.*
--first-parent --long --tags
[  +10 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.14.4-0-g5e1000cd8
[   +6 ms] executing: [/Users/sanekyy/Programs/flutter/] git rev-parse --abbrev-ref --symbolic
@{u}
[   +9 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/dev
[        ] executing: [/Users/sanekyy/Programs/flutter/] git ls-remote --get-url origin
[   +8 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +42 ms] executing: [/Users/sanekyy/Programs/flutter/] git rev-parse --abbrev-ref HEAD
[   +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] dev
[   +4 ms] executing: sw_vers -productName
[  +12 ms] Exit code 0 from: sw_vers -productName
[        ] Mac OS X
[        ] executing: sw_vers -productVersion
[  +13 ms] Exit code 0 from: sw_vers -productVersion
[        ] 10.15.2
[        ] executing: sw_vers -buildVersion
[  +14 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 19C57
[  +25 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping
update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +26 ms] executing: /Users/sanekyy/Library/Android/sdk/platform-tools/adb devices -l
[   +6 ms] Exit code 0 from: /Users/sanekyy/Library/Android/sdk/platform-tools/adb devices -l
[        ] List of devices attached
[  +13 ms] executing:
/Users/sanekyy/Programs/flutter/bin/cache/artifacts/libimobiledevice/idevice_id -h
[  +45 ms] executing: /usr/bin/xcode-select --print-path
[   +5 ms] Exit code 0 from: /usr/bin/xcode-select --print-path
[        ] /Applications/Xcode.app/Contents/Developer
[        ] executing: /usr/bin/xcodebuild -version
[  +86 ms] Exit code 0 from: /usr/bin/xcodebuild -version
[        ] Xcode 11.3.1
           Build version 11C504
[   +3 ms] /usr/bin/xcrun simctl list --json devices
[  +96 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping
update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +58 ms] Found plugin amplitude_flutter at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-1.1.3/
[   +7 ms] Found plugin apple_sign_in at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/apple_sign_in-0.1.0/
[  +26 ms] Found plugin device_info at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.1+1/
[   +1 ms] Found plugin esys_flutter_share at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/esys_flutter_share-1.0.2/
[   +2 ms] Found plugin firebase_analytics at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-5.0.9/
[   +2 ms] Found plugin firebase_core at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+2/
[   +2 ms] Found plugin firebase_core_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+1/
[   +1 ms] Found plugin firebase_crashlytics at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-0.1.2+4/
[   +1 ms] Found plugin firebase_dynamic_links at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_dynamic_links-0.5.0+9/
[   +1 ms] Found plugin firebase_performance at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_performance-0.3.1+5/
[   +1 ms] Found plugin firebase_remote_config at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_remote_config-0.3.0+1/
[  +13 ms] Found plugin google_maps_flutter at
/Users/sanekyy/.pub-cache/git/plugins-a6424b19e2b2b31b6c69afb9b99b8326ba9962e8/packages/google_m
aps_flutter/
[   +1 ms] Found plugin google_sign_in at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/
[   +1 ms] Found plugin google_sign_in_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.2+1/
[  +10 ms] Found plugin package_info at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.0+10/
[   +3 ms] Found plugin path_provider at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.5.1/
[   +6 ms] Found plugin sensors at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.0+1/
[   +1 ms] Found plugin shared_preferences at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.4+5/
[   +3 ms] Found plugin sqflite at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.6+5/
[   +4 ms] Found plugin url_launcher at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/
[        ] Found plugin url_launcher_macos at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/
[   +1 ms] Found plugin url_launcher_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.0+2/
[   +1 ms] Found plugin video_player at
/Users/sanekyy/.pub-cache/git/plugins-a3a36cadffa5d8caa4aa89f93a12e7378b9070f3/packages/video_pl
ayer/video_player/
[   +1 ms] Found plugin video_player_web at
/Users/sanekyy/.pub-cache/git/plugins-a3a36cadffa5d8caa4aa89f93a12e7378b9070f3/packages/video_pl
ayer/video_player_web/
[  +24 ms] Found plugin amplitude_flutter at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-1.1.3/
[   +1 ms] Found plugin apple_sign_in at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/apple_sign_in-0.1.0/
[  +10 ms] Found plugin device_info at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.1+1/
[   +1 ms] Found plugin esys_flutter_share at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/esys_flutter_share-1.0.2/
[   +1 ms] Found plugin firebase_analytics at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-5.0.9/
[        ] Found plugin firebase_core at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+2/
[   +1 ms] Found plugin firebase_core_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+1/
[        ] Found plugin firebase_crashlytics at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-0.1.2+4/
[        ] Found plugin firebase_dynamic_links at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_dynamic_links-0.5.0+9/
[        ] Found plugin firebase_performance at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_performance-0.3.1+5/
[        ] Found plugin firebase_remote_config at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_remote_config-0.3.0+1/
[   +6 ms] Found plugin google_maps_flutter at
/Users/sanekyy/.pub-cache/git/plugins-a6424b19e2b2b31b6c69afb9b99b8326ba9962e8/packages/google_m
aps_flutter/
[        ] Found plugin google_sign_in at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/
[   +1 ms] Found plugin google_sign_in_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.2+1/
[   +6 ms] Found plugin package_info at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.0+10/
[   +1 ms] Found plugin path_provider at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.5.1/
[   +5 ms] Found plugin sensors at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.0+1/
[   +1 ms] Found plugin shared_preferences at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.4+5/
[   +2 ms] Found plugin sqflite at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.6+5/
[   +3 ms] Found plugin url_launcher at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/
[        ] Found plugin url_launcher_macos at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/
[        ] Found plugin url_launcher_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.0+2/
[   +1 ms] Found plugin video_player at
/Users/sanekyy/.pub-cache/git/plugins-a3a36cadffa5d8caa4aa89f93a12e7378b9070f3/packages/video_pl
ayer/video_player/
[        ] Found plugin video_player_web at
/Users/sanekyy/.pub-cache/git/plugins-a3a36cadffa5d8caa4aa89f93a12e7378b9070f3/packages/video_pl
ayer/video_player_web/
[  +45 ms] Generating
/Users/sanekyy/Projects/optimist.dev/gohere/gohere/android/app/src/main/java/io/flutter/plugins/
GeneratedPluginRegistrant.java
[ +106 ms] Launching lib/main.dart on Chrome in debug mode...
[        ] Building application for the web...
[ +162 ms] Found plugin amplitude_flutter at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-1.1.3/
[   +1 ms] Found plugin apple_sign_in at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/apple_sign_in-0.1.0/
[   +8 ms] Found plugin device_info at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.1+1/
[        ] Found plugin esys_flutter_share at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/esys_flutter_share-1.0.2/
[        ] Found plugin firebase_analytics at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-5.0.9/
[        ] Found plugin firebase_core at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+2/
[        ] Found plugin firebase_core_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+1/
[        ] Found plugin firebase_crashlytics at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-0.1.2+4/
[        ] Found plugin firebase_dynamic_links at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_dynamic_links-0.5.0+9/
[        ] Found plugin firebase_performance at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_performance-0.3.1+5/
[        ] Found plugin firebase_remote_config at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/firebase_remote_config-0.3.0+1/
[   +4 ms] Found plugin google_maps_flutter at
/Users/sanekyy/.pub-cache/git/plugins-a6424b19e2b2b31b6c69afb9b99b8326ba9962e8/packages/google_m
aps_flutter/
[        ] Found plugin google_sign_in at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/
[        ] Found plugin google_sign_in_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.2+1/
[   +4 ms] Found plugin package_info at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.0+10/
[   +1 ms] Found plugin path_provider at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.5.1/
[   +3 ms] Found plugin sensors at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.0+1/
[        ] Found plugin shared_preferences at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.4+5/
[   +1 ms] Found plugin sqflite at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.6+5/
[   +2 ms] Found plugin url_launcher at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/
[        ] Found plugin url_launcher_macos at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/
[        ] Found plugin url_launcher_web at
/Users/sanekyy/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.0+2/
[        ] Found plugin video_player at
/Users/sanekyy/.pub-cache/git/plugins-a3a36cadffa5d8caa4aa89f93a12e7378b9070f3/packages/video_pl
ayer/video_player/
[        ] Found plugin video_player_web at
/Users/sanekyy/.pub-cache/git/plugins-a3a36cadffa5d8caa4aa89f93a12e7378b9070f3/packages/video_pl
ayer/video_player_web/
[+5303 ms] Starting daemon...
[ +172 ms] Initializing inputs
[  +11 ms] Reading cached asset graph...
[ +211 ms] Reading cached asset graph completed, took 209ms

[ +221 ms] Checking for updates since last build...
[ +896 ms] Checking for updates since last build completed, took 896ms

[  +14 ms] Initializing inputs
[   +2 ms] Reading cached asset graph...
[        ] Reading cached asset graph completed, took 209ms
[        ] Checking for updates since last build...
[        ] Checking for updates since last build completed, took 896ms
[+1224 ms] About to build [web]...
[   +3 ms] Running build...
[ +231 ms] Running build completed, took 107ms

[        ] Caching finalized dependency graph...
[   +6 ms] Caching finalized dependency graph completed, took 148ms

[   +4 ms] Succeeded after 262ms with 0 outputs (0 actions)

[   +7 ms] Building application for the web... (completed in 8.5s)
[        ] Attempting to connect to browser instance..
[+3177 ms] Debug service listening on ws://127.0.0.1:55804/y-op7PSxIGw=

[ +351 ms]       Failed to load asset at path:
packages/build_web_compilers/src/dev_compiler/dart_sdk.js.

                          Status code: 404

                          Headers:
                          {
                      "date": "Sat, 25 Jan 2020 12:13:32 GMT",
                      "content-length": "9",
                      "x-frame-options": "SAMEORIGIN",
                      "content-type": "text/plain; charset=utf-8",
                      "x-xss-protection": "1; mode=block",
                      "x-content-type-options": "nosniff",
                      "server": "dart:io with Shelf",
                      "via": "1.1 shelf_proxy"
                    }

                          Content:
                          Not Found}

[  +35 ms] Attempting to connect to browser instance.. (completed in 3.6s)
[   +1 ms] Warning: Flutter's support for web development is not stable yet and hasn't
[        ] been thoroughly tested in production environments.
[        ] For more information see https://flutter.dev/web
[        ] 🔥  To hot restart changes while running, press "r". To hot restart (and refresh the
browser),
           press "R".
[   +1 ms] For a more detailed help message, press "h". To quit, press "q".
[   +8 ms] Debug service listening on ws://127.0.0.1:55804/y-op7PSxIGw=

flutter analyze
Analyzing gohere...                                                     

   info • Unused import: 'package:built_value/built_value.dart' •
          lib/data/model/db/place.dart:1:8 • unused_import
   info • The declaration '_tag' isn't referenced • lib/domain/place_bloc.dart:7:7 •
          unused_element
   info • The value of the field '_preferencesService' isn't used •
          lib/domain/sign_in_bloc.dart:12:28 • unused_field
   info • Unused import: 'package:gohere/service/analytics/analytics_service.dart' •
          lib/ui/bottom_sheet/feedback_bottom_sheet.dart:5:8 • unused_import
   info • The value of the local variable 'success' isn't used •
          lib/ui/bottom_sheet/sign_in_bottom_sheet.dart:103:11 • unused_local_variable

5 issues found. (ran in 6.4s)
 flutter doctor -v
[✓] Flutter (Channel dev, v1.14.4, on Mac OS X 10.15.2 19C57, locale en-RU)
    • Flutter version 1.14.4 at /Users/sanekyy/Programs/flutter
    • Framework revision 5e1000cd85 (2 days ago), 2020-01-23 13:27:01 -0800
    • Engine revision 83a64b7233
    • Dart version 2.8.0 (build 2.8.0-dev.3.0 ef0c7f16e6)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/sanekyy/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Users/sanekyy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.3

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

[✓] Android Studio (version 3.5)
    • Android Studio at /Users/sanekyy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
    • IntelliJ at /Users/sanekyy/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • macOS      • macOS      • darwin-x64     • Mac OS X 10.15.2 19C57
    • Chrome     • chrome     • web-javascript • Google Chrome 79.0.3945.130
    • Web Server • web-server • web-javascript • Flutter Tools

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityplatform-webWeb applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions