I am trying to deploy a Flutter web app to Firebase hosting using the FirebaseExtended/action-hosting-deploy action and the experimental webframeworks
flag. Here is my GitHub workflow file:
name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.0
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_FAST }}
channelId: live
projectId: flutter-fast
target: flutter-ast-viewer
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
Whenever this workflow runs, the web page gets updated but it’s blank and the following error appears on the network tab:
GET https://flutter-ast-viewer.web.app/flutter_bootstrap.js net::ERR_ABORTED 404 (Not Found)
If I deploy the app using the command line (firebase deploy
), everything works fine.
Firebase.json
{
"hosting": {
"site": "flutter-ast-viewer",
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "us-east1"
}
}
}
.firebaserc
{
"projects": {
"default": "flutter-ast-viewer"
}
}
I tried a bunch of other things but it seems like something gets broken in the GitHub action. Manual deploys work fine.
"error": "Must supply a "public" or "source" directory or at least one rewrite or redirect in each "hosting" config."
Error: Hosting configs should only include either "site" or "target", not both.
"error": "Can only specify "source" or "public" in a Hosting config, not both"
Error: Directory ‘build/web’ for Hosting does not exist.
2
Answers
I have the same problem, this was my solution:
On webindex.html look at this:
[enter image description here][1]
[1]: https://i.sstatic.net/wijVuZzY.png
change
for
I’ts because the path its wrong, that works for me
This is my flutter action, you can check it, be careful with the flutter versions
name: Analyze, Build and Deploy