Skip to content

Firebase hosting issues with assetlinks.json #7685

@Kurczaak

Description

@Kurczaak

I am trying to host assetlinks.json file on my Flutter web app using GitHub actions and Firebase hosting. I successfully managed to achieve this in one of my projects. Unfortunately, when I copy-pasted the configuration to my other project, it does not work. I have tried multiple solutions like:

  • Creating assetlinks.json in GitHub actions both in web, and/or build/web folders
  • Deploying web folder with ./well-known/assetlinks.json file
  • Verifying the content of build./well-known/assetlinks.json file before deployment (It's always correct)
  • Adding "dynamicLinks": true in my firebase.json rewrites section
  • Adding "appAssociation": "NONE"/ "appAssociation": "AUTO" in my firebase.json
  • Verifying the content in browser, postman and https://developers.google.com/digital-asset-links/tools/generator.
    I feel like I've tried every possible solution. What's more concerning is that I literally copied the setup of one project into another. However, this works perfect when I host the app using 'firebase deploy' in my terminal

[REQUIRED] Environment info

firebase-tools: 13.14.2

Platform: macOS

[REQUIRED] Test case

Host a new Flutter Web App using Github actions with the following config:

firebase.json
{ "hosting": { "public": "build/web", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "headers": [ { "source": "/.well-known/assetlinks.json", "headers": [ { "key": "Content-Type", "value": "application/json" } ] } ], "rewrites": [ { "source": "/.well-known/assetlinks.json", "destination": "/.well-known/assetlinks.json" } ] } }

firebase-hosting-merge.yml
`name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- main
permissions:
checks: write
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: 3.24.1

  - name: 🛠️ Build the application
    run: flutter build web

  - name: ⬇️ Archive Production Artifact
    uses: actions/upload-artifact@master
    with:
      name: build
      path: build/web

deploy:
name: "Deploy"
runs-on: ubuntu-latest
needs: build
steps:
- name: 📚 Checkout repo
uses: actions/checkout@v4
- name: ⬇️ Download Artifact
uses: actions/download-artifact@master
with:
name: build
path: build/web

  - name: 🎯 Deploy to firebase
    uses: FirebaseExtended/action-hosting-deploy@v0
    with:
      repoToken: '${{ secrets.GITHUB_TOKEN }}'
      firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_YOUR_PROJECT }}'
      projectId: your-project-id
      channelId: live`

[REQUIRED] Steps to reproduce

  1. Create a new Flutter app
  2. Create a new Firebase project
  3. Run firebase init and setup Hosting with GitHub actions
  4. Replace the content of firebase-hosting-merge.yml and firebase.json with your data
  5. Add web/.well-known/assetlinks.json file according to the generator https://developers.google.com/digital-asset-links/tools/generator.
  6. Push changes to main branch, running github actions
  7. Visit your-domain.com/.well-known/assetlinks.json

[REQUIRED] Expected behavior

your-domain.com/.well-known/assetlinks.json returns a valid assetlinks.json file

[REQUIRED] Actual behavior

your-domain.com/.well-known/assetlinks.json returns []

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions