Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am facing issues deploying my Flutter web app to Firebase Hosting. The deployment process was working fine, but now I'm encountering a persistent HTTP 400 error with the message "Precondition check failed" during deployment. The deployment progress stops at 94%, indicating around 1050/1056 files.

-> firebase.json

{
  "hosting": {
    "public": "build/web",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

.firebasearc

{
  "projects": {
    "default": "beta-realte",
    "beta": "beta-realte"
  },
  "targets": {},
  "etags": {}
}

web/index.html (firebase script)

<pre lang="HTML"><script type="module">
    // Import the functions you need from the SDKs you need
    import { initializeApp } from "https://www.gstatic.com/firebasejs/10.6.0/firebase-app.js";
    import { getAnalytics } from "https://www.gstatic.com/firebasejs/10.6.0/firebase-analytics.js";
    // TODO: Add SDKs for Firebase products that you want to use
    // https://firebase.google.com/docs/web/setup#available-libraries

    // Your web app's Firebase configuration
    // For Firebase JS SDK v7.20.0 and later, measurementId is optional
    const firebaseConfig = {
      apiKey: "AIzaSyDrSHgpYqh_PU_mcflJ55NZlgQ2kiEuHxI",
      authDomain: "beta-realte.firebaseapp.com",
      projectId: "beta-realte",
      storageBucket: "beta-realte.appspot.com",
      messagingSenderId: "761478122239",
      appId: "1:761478122239:web:9fa1e302a2edf0e30adaca",
      measurementId: "G-XF35Y47QGP"
    };

    // Initialize Firebase
    const app = initializeApp(firebaseConfig);
    const analytics = getAnalytics(app);
  </script>


What I have tried:

Troubleshooting Steps Taken:

Removed the 'redirects' section in the firebase.json file.
Upgraded Firebase tools.
Reran firebase init.
Deleted the .firebase folder and redeployed.
Attempted deployment on a new web app after deleting the current web app.
Tried different variations in the firebase.json file.

I've run the `firebase deploy --debug` command on terminal and this is the shortened version of the output I'm getting:

Terminal
[2023-11-16T07:01:50.737Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/761478122239/sites/beta-realte/versions/b99a036f10914190:populateFiles 400
[2023-11-16T07:01:50.737Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/761478122239/sites/beta-realte/versions/b99a036f10914190:populateFiles {"error":{"code":400,"message":"Precondition check failed.","status":"FAILED_PRECONDITION"}}
[2023-11-16T07:01:51.223Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/761478122239/sites/beta-realte/versions/b99a036f10914190:populateFiles 400
[2023-11-16T07:01:51.224Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/761478122239/sites/beta-realte/versions/b99a036f10914190:populateFiles {"error":{"code":400,"message":"Precondition check failed.","status":"FAILED_PRECONDITION"}}
i  hosting: adding files to version [0/1057] (0%) 
[2023-11-16T07:01:52.350Z] [populateQueue] Retrying task index 1
[2023-11-16T07:01:52.351Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/761478122239/sites/beta-realte/versions/b99a036f10914190:populateFiles [none]
Posted
Updated 16-Nov-23 6:14am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900