app works when deployed to the cloud. can’t connect to firebase in Google AI. "
@firebase/firestore:" “Firestore (10.12.2): Could not reach Cloud Firestore backend. Backend didn’t respond within 10 seconds.\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.” "
How I’m loading :
<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-firestore-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-storage-compat.js"></script>
// Initialize the app if it hasn't been already.
if (!firebase.apps.length) {
firebase.initializeApp(firebaseConfig);
}
// Set log level to 'error' to suppress verbose console output and prevent crashes
// from the SDK trying to log complex objects with circular references.
firebase.setLogLevel('error');
const app = firebase.app(); // Get the default app instance
const db = firebase.firestore();
// Enable long polling to resolve connection issues in restrictive environments.
// Explicitly disable auto-detection to resolve the conflict.
// The { merge: true } option prevents overriding default settings like the host.
db.settings({
experimentalForceLongPolling: true,
experimentalAutoDetectLongPolling: false,
merge: true
});
const storage = firebase.storage();
firebaseServices = { app, db, storage };
return firebaseServices;