I’m pulling my hair because search function doesn’t work on my website. The error message has something to do with CORS is not allowed. I did some testing and the search function running well on default firebase url (I’m using custom domain name). After some googling and pulling some hair I got the solution. You need to add a header section into firebase.json.
below is the default firebase.json file:
{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}
Now you need to change it into:
{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "headers": [
      {
          "source": "**",
          "headers": [
              {
                  "key": "Access-Control-Allow-Origin",
                  "value": "*"
              }
          ]
      }
    ]
  }
}
Now deploy your website and test it again. I hope it will help. ^^
