Fixing Flutter errors on AWS Amplify: [WARNING] fatal Not a valid object name origin/master

Here I'm describing how to fix this error

Page content

Some time ago I described how to Deploy Flutter project with backend to AWS Amplify.

After flutter team released new version, that method fails with [WARNING]: fatal: Not a valid object name origin/master.

Here I’m describing how to fix this Flutter Error: Not a valid object name origin/master.

sorting out the bugs

Flutter Error on AWS Amplify

The error looks like:

2025-02-22T11:40:59.996Z [INFO]: # Executing command: echo "Installing Flutter SDK"
Installing Flutter SDK
# Executing command: git clone https://github.com/flutter/flutter.git -b stable --depth 1
2025-02-22T11:40:59.997Z [WARNING]: Cloning into 'flutter'...
2025-02-22T11:41:06.271Z [INFO]: # Executing command: export PATH="$PATH:$(pwd)/flutter/bin"
2025-02-22T11:41:06.276Z [INFO]: # Executing command: flutter config --no-analytics
2025-02-22T11:41:06.294Z [WARNING]: fatal: Not a valid object name origin/master
2025-02-22T11:41:06.373Z [ERROR]: !!! Build failed
2025-02-22T11:41:06.373Z [ERROR]: !!! Error: Command failed with exit code 128

Reasons

It’s happening because - Flutter Web fails to build when running on AWS Amplify Hosting Flutter tool fails with shallow clone of repository in 3.29.0+

reason-monorepo switch

Fix

In AWS Amplify build config

instead of

git clone https://github.com/flutter/flutter.git -b stable --depth 1

put

git clone https://github.com/flutter/flutter.git -b '3.27.4' --depth 1

It will use previous version of flutter.

Still need to keep an eye on new flutter releases, in hope they fix it.

Subscribe

Get new posts on AI systems, Infrastructure, and AI engineering.