Search code examples
firebasefirebase-hosting

Firebase Hosting Deployment Error HTTP 400 Error


I was trying to redeploy my react app on firebase after fixing some issues. But redeploying is giving errors. Not sure what the problem is.

I also tried to look into the answers provided in other posts but nothing worked for me.

firebase.json details below:

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [{
      "source": "**",
      "destination": "/index.html",
      "headers": [{
        "key": "Cache-Control",
        "value": "max-age=0"
      }]
    }]
  }
}

Error: HTTP Error: 400, hosting.rewrites[0] is not exactly one from [subschema 0],[subschema 1]

This is the first time I have come across this error. So no idea what the problem is.


Solution

  • Headers options look line inside of rewrites parameters. instead, you need to move out as:

    "hosting": {
        "public": "build",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [{
          "source": "**",
          "destination": "/index.html"
        }],
        "headers": [{
            "key": "Cache-Control",
            "value": "max-age=0"
        }]
      }