Skip to content

Intermittent Failure Downloading Flutter Fonts During Web Build Deployment #5888

@volo-uti

Description

@volo-uti

I'm experiencing an issue while deploying my Flutter web app. During the build process, the download of fonts.zip from Google's Flutter storage intermittently fails. It succeeds only about 2–3 times out of 10 deployments.

Here is the relevant error log:

2025-02-03T03:09:24.189Z [WARNING]: Failed to download https://storage.googleapis.com/flutter_infra_release/flutter/fonts/3012db47f3130e62f7cc0beabff968a33cbec8d8/fonts.zip. Ensure you have network connectivity and then try again.
                                    HttpException: Connection closed while receiving data, uri = https://storage.googleapis.com/flutter_infra_release/flutter/fonts/3012db47f3130e62f7cc0beabff968a33cbec8d8/fonts.zip
2025-02-03T03:09:24.193Z [ERROR]: !!! Build failed
2025-02-03T03:09:24.193Z [ERROR]: !!! Error: Command failed with exit code 1

This issue occurs inconsistently, and I’m not sure when it started. My network connection is stable, and other parts of the build process seem to work fine.
Has anyone encountered this problem before? Are there any known solutions or workarounds to ensure the fonts download reliably during the build?
Thanks in advance!

Build Log

2025-02-03T03:08:47.403Z [WARNING]: Cloning into 'flutter'...
2025-02-03T03:08:51.597Z [WARNING]: Note: switching to '2663184aa79047d0a33a14a3b607954f8fdd8730'.
                                    You are in 'detached HEAD' state. You can look around, make experimental
                                    changes and commit them, and you can discard any commits you make in this
                                    state without impacting any branches by switching back to a branch.
                                    If you want to create a new branch to retain commits you create, you may
                                    do so (now or later) by using -c with the switch command. Example:
                                    git switch -c <new-branch-name>
                                    Or undo this operation with:
                                    git switch -
                                    Turn off this advice by setting config variable advice.detachedHead to false
2025-02-03T03:08:52.097Z [INFO]: # Executing command: flutter config --no-analytics
2025-02-03T03:08:52.126Z [WARNING]: Downloading Linux x64 Dart SDK from Flutter engine 36335019a8eab588c3c2ea783c618d90505be233...
2025-02-03T03:08:52.132Z [INFO]: % Total    %
2025-02-03T03:08:52.132Z [INFO]: Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
                                 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2025-02-03T03:08:52.403Z [INFO]: 0  203M    0  5503    0
2025-02-03T03:08:52.404Z [INFO]: 0  20255      0  2:55:36 --:--:--  2:55:36 20231
2025-02-03T03:08:53.338Z [INFO]: 3  203M    3 7039k    0     0  5836k
2025-02-03T03:08:53.338Z [INFO]: 0  0:00:35  0:00:01  0:00:34 5831k
2025-02-03T03:08:54.338Z [INFO]: 18  203M   18 37.7M    0
2025-02-03T03:08:54.339Z [INFO]: 0  17.1M      0  0:00:11  0:00:02  0:00:09 17.1M
2025-02-03T03:08:55.375Z [INFO]: 33  203M   33 69.0M    0     0
2025-02-03T03:08:55.380Z [INFO]: 21.2M      0  0:00:09  0:00:03  0:00:06 21.2M
2025-02-03T03:08:56.338Z [INFO]: 48  203M   48 98.7M    0     0  23.4M      0  0:00:08  0:00:04  0:00:04 23.4M
2025-02-03T03:08:57.338Z [INFO]: 64  203M   64  131M    0     0  25.1M      0  0:00:08  0:00:05  0:00:03 26.5M
2025-02-03T03:08:58.345Z [INFO]: 76  203M   76  156M    0
2025-02-03T03:08:58.346Z [INFO]: 0  25.1M      0  0:00:08  0:00:06  0:00:02 29.8M
2025-02-03T03:08:59.405Z [INFO]: 92  203M   92  189M    0     0
2025-02-03T03:08:59.411Z [INFO]: 26.0M      0  0:00:07  0:00:07 --:--:-- 29.8M
2025-02-03T03:08:59.835Z [INFO]: 100  203M  100  203M    0     0  26.4M      0  0:00:07  0:00:07 --:--:-- 30.1M
2025-02-03T03:09:04.192Z [WARNING]: Building flutter tool...
2025-02-03T03:09:04.361Z [INFO]: Resolving dependencies...
2025-02-03T03:09:05.468Z [INFO]: Downloading packages...
2025-02-03T03:09:08.634Z [INFO]: Got dependencies.
2025-02-03T03:09:23.682Z [INFO]: 
2025-02-03T03:09:23.687Z [INFO]: ╔════════════════════════════════════════════════════════════════════════════╗
                                 ║                 Welcome to Flutter! - https://flutter.dev                  ║
                                 ║                                                                            ║
                                 ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
                                 ║ statistics and basic crash reports. This data is used to help improve      ║
                                 ║ Flutter tools over time.                                                   ║
                                 ║                                                                            ║
                                 ║ Flutter tool analytics are not sent on the very first run. To disable      ║
                                 ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
                                 ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
                                 ║ event will be sent, and then no further information will be sent by the    ║
                                 ║ Flutter tool.                                                              ║
                                 ║                                                                            ║
                                 ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
                                 ║ The Google Privacy Policy describes how data is handled in this service.   ║
                                 ║                                                                            ║
                                 ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
                                 ║ crash reports to Google.                                                   ║
                                 ║                                                                            ║
                                 ║ Read about data we send with crash reports:                                ║
                                 ║ https://flutter.dev/to/crash-reporting                                     ║
                                 ║                                                                            ║
                                 ║ See Google's privacy policy:                                               ║
                                 ║ https://policies.google.com/privacy                                        ║
                                 ║                                                                            ║
                                 ║ To disable animations in this tool, use                                    ║
                                 ║ 'flutter config --no-cli-animations'.                                      ║
                                 ╚════════════════════════════════════════════════════════════════════════════╝
2025-02-03T03:09:23.735Z [INFO]: Analytics reporting disabled.
2025-02-03T03:09:23.735Z [INFO]: You may need to restart any open editors for them to read new settings.
2025-02-03T03:09:23.746Z [INFO]: # Executing command: flutter pub get
2025-02-03T03:09:23.839Z [INFO]: Downloading Material fonts...
2025-02-03T03:09:24.041Z [INFO]: 195ms
2025-02-03T03:09:24.042Z [INFO]: Downloading Material fonts...
2025-02-03T03:09:24.185Z [INFO]: 143ms
2025-02-03T03:09:24.185Z [INFO]: 
2025-02-03T03:09:24.189Z [WARNING]: Failed to download https://storage.googleapis.com/flutter_infra_release/flutter/fonts/3012db47f3130e62f7cc0beabff968a33cbec8d8/fonts.zip. Ensure you have network connectivity and then try again.
                                    HttpException: Connection closed while receiving data, uri = https://storage.googleapis.com/flutter_infra_release/flutter/fonts/3012db47f3130e62f7cc0beabff968a33cbec8d8/fonts.zip
2025-02-03T03:09:24.193Z [ERROR]: !!! Build failed
2025-02-03T03:09:24.193Z [ERROR]: !!! Error: Command failed with exit code 1
2025-02-03T03:09:24.193Z [INFO]: # Starting environment caching...
2025-02-03T03:09:24.193Z [INFO]: # Uploading environment cache artifact...
2025-02-03T03:09:24.291Z [INFO]: # Uploaded environment cache artifact
2025-02-03T03:09:24.292Z [INFO]: # Environment caching completed

amplify.yaml

version: 1
frontend:
  phases:
    preBuild:
      commands:
        # 브랜치 매핑 로직 추가
        - |
          case "$AWS_BRANCH" in
            "develop") TARGET_BRANCH="dev" ;;
            "main") TARGET_BRANCH="main" ;;
            *) TARGET_BRANCH="$AWS_BRANCH" ;;
          esac

        # 설정 값 출력
        - echo "BackendAppID - $BACKEND_APP_ID"
        - echo "FlutterVersion - $FLUTTER_VERSION"
        - echo "TargetBranch - $TARGET_BRANCH"

          # Flutter 설치 확인 및 필요 시 삭제/재설치
        - |
          export PATH="$(pwd)/flutter/bin:$PATH"
          if [ -d flutter ]; then
            INSTALLED_FLUTTER_VERSION=$(flutter/bin/flutter --version | awk '/Flutter/ {print $2}')
            echo "설치된 Flutter 버전: $INSTALLED_FLUTTER_VERSION"
            if [ "$INSTALLED_FLUTTER_VERSION" != "$FLUTTER_VERSION" ]; then
              echo "Flutter 버전 불일치. 기존 버전을 삭제하고 다시 설치합니다."
              rm -rf flutter
            fi
          fi
          if [ ! -d flutter ]; then
            echo "Flutter $FLUTTER_VERSION 설치 중..."
            git clone https://github.com/flutter/flutter.git --depth 1 -b $FLUTTER_VERSION flutter
          else
            echo "Flutter가 이미 설치되어 있습니다."
          fi

        # Flutter 환경 설정
        - flutter config --no-analytics
        - flutter doctor -v

        # Flutter 패키지 설치
        - flutter pub get

        # Amplify CLI 설치
        - npm create amplify@latest -y

        # Amplify CLI 명령 실행 (Gen2 기반)
        - npx ampx generate outputs --out-dir lib --format dart --branch $TARGET_BRANCH --app-id $BACKEND_APP_ID
        - npx ampx generate graphql-client-code --format modelgen --model-target dart --out lib/models --branch $TARGET_BRANCH --app-id $BACKEND_APP_ID
    build:
      commands:
        # 코드 생성 및 기존 충돌 파일 삭제
        - flutter pub run build_runner build --delete-conflicting-outputs

        # 웹 빌드
        - flutter build web
  artifacts:
    baseDirectory: build/web
    files:
      - "**/*"
  cache:
    paths:
      - flutter/.pub-cache

Metadata

Metadata

Assignees

Labels

BuildIssues related to building apps using Amplify flutterpending-maintainer-responsePending response from a maintainer of this repositoryquestionA question about the Amplify Flutter libraries

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions