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 { 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";
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"
};
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:
[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]