Risolvere gli errori di Flutter su AWS Amplify: [WARNING] fatal Non è un nome valido di oggetto origin/master
Ecco come risolvere questo errore
Qualche tempo fa ho descritto come Deploy Flutter project with backend to AWS Amplify.
Dopo che il team Flutter ha rilasciato una nuova versione, quel metodo non funziona più con [WARNING]: fatal: Not a valid object name origin/master
.
Ecco come risolvere questo problema Flutter Error: Not a valid object name origin/master.
Errore Flutter su AWS Amplify
L’errore sembra essere:
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
Causa
Questo accade perché - Flutter Web non riesce a costruire quando viene eseguito su AWS Amplify Hosting Flutter fallisce con un clone superficiale del repository in 3.29.0+
Soluzione
Nella configurazione di costruzione di AWS Amplify
invece di
git clone https://github.com/flutter/flutter.git -b stable --depth 1
metti
git clone https://github.com/flutter/flutter.git -b '3.27.4' --depth 1
Questo utilizzerà una versione precedente di Flutter.
Tuttavia, è comunque necessario tenere d’occhio le nuove release di Flutter, sperando che risolvano il problema.
Link utili
- https://github.com/flutter/flutter/issues/163547
- Deploy Flutter project with backend to AWS Amplify
- [Flutter (Dart) Cheat Sheet](https://www.glukhov.org/it/post/2022/flutter-dart-cheatsheet/ “Flutter (Dart) Cheatsheet with exampl
- Flutter project with AWS Amplify backend
- Install Flutter
- Dockerising Flutter Web app with dockerised Flutter build and Nginx