I wrote a Flutter web application that connects via http to Firebase Cloud Functions api. I runs with no error in debug mode (run using flutter -d chrome). However when I deployed the web application to Firebase Hosting and open the result homepage in Chrome, I get the following error when requesting http.get method :
Exception : XMLHttpRequest error
But i I open the homepage in Firefox there is no error and the cloud function returns data. I know from several sources that we can disable Chrome security to get rid of this error, but this is not accepted because ordinary users may just think that the web site is not working.
In my serverside code I use Express and have enable CORS (as I found several tips about the error is related to CORS) :
const app = require("express")();
const cors = require("cors")({ origin: true});
In my firebase project \Authentication\Sign-in method\Authorized domain, I see the generated flutter web app domain myproject.firebaseapp.com is listed, so it is whitelisted.
I have spent hours looking for solutions, but no luck so far. Anyone can help?