after looking at all the threads and suggestions, for me I still get the error. adding experimentalForceLongPolling:true did not help. I tired another flag as well without any luck.
File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-02-28T06:19:42.293Z] @firebase/firestore: Firestore (9.23.0): WebChannelConnection RPC 'Listen' stream 0x4146ee4a transport errored: [object Object]
2025-02-28 00:19:42.298 27910-27910 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-02-28T06:19:42.296Z] @firebase/firestore: Firestore (9.23.0): PersistentStream close with error: FirebaseError: [code=unavailable]: The operation could not be completed
2025-02-28 00:19:42.303 27910-27910 Capacitor/Console it.moblize.baniya E File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-02-28T06:19:42.299Z] @firebase/firestore: Firestore (9.23.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unavailable]: The operation could not be completed
This 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.
2025-02-28 00:19:42.309 27910-27910 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-02-28T06:19:42.306Z] @firebase/firestore: Firestore (9.23.0): MemoryPersistence Starting transaction: Release target
2025-02-28 00:19:42.315 27910-27910 Capacitor/Console it.moblize.baniya E File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: ERROR Error: Uncaught (in promise): FirebaseError: [code=unavailable]: Failed to get document because the client is offline.
FirebaseError: Failed to get document because the client is offline.
2025-02-28 00:19:42.316 27910-27910 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-02-28T06:19:42.314Z] @firebase/firestore: Firestore (9.23.0): MemoryPersistence Starting transaction: Release target
2025-02-28 00:19:42.318 27910-27910 Capacitor/Console it.moblize.baniya E File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: ERROR Error: Uncaught (in promise): FirebaseError: [code=unavailable]: Failed to get document because the client is offline.
FirebaseError: Failed to get document because the client is offline.
2025-02-28 00:19:42.320 27910-27910 Capacitor/Console it.moblize.baniya I File: https://localhost/main.7f6f6bc5bd9d23e4.js - Line 1 - Msg: [2025-02-28T06:19:42.318Z] @firebase/firestore: Firestore (9.23.0): WebChannelConnection Creating RPC 'Listen' stream 0x4146ee4b: .firestore.v1.Firestore/Listen/channel {"httpSessionIdParam":"gsessionid","initMessageHeaders":{"X-Goog-Api-Client":"gl-js/ fire/9.23.0","Content-Type":"text/plain","X-Firebase-GMPID":"1:329500481487:web:7157d20dc5123abd4ea4ba"},"messageUrlParams":{"database":"projects/baniya-38d78/databases/(default)"},"sendRawJson":true,"supportsCrossDomainXhr":true,"internalChannelParams":{"forwardChannelRequestTimeoutMs":600000},"forceLongPolling":true,"detectBufferingProxy":false,"xmlHttpFactory":{"l":null,"j":false},"encodeInitMessageHeaders":true}
my app.module.ts looks like below:
const firebaseConfig = {
databaseURL: '',
apiKey: "XXXX",
authDomain: "XXX.firebaseapp",
projectId: "XXX-38d78",
storageBucket: "XXX-38d78.appspot",
messagingSenderId: "XXXX",
appId: "1:XXXX:web:XXX",
measurementId: "G-XXXX"
};
@NgModule({
declarations: [
AppComponent,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [
BrowserModule,
IonicModule.forRoot(
{
mode: 'ios'
}
),
provideFirebaseApp(() => initializeApp(firebaseConfig)),
provideAuth(() => {
if (Capacitor.isNativePlatform()) {
return initializeAuth(getApp(), {
persistence: indexedDBLocalPersistence,
});
} else {
return getAuth();
}
}),
provideFirestore(() => {
return initializeFirestore(getApp(), {
experimentalForceLongPolling: true,
})
}),
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
CurrencyPipe
],
providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
CurrencyPipe
],
bootstrap: [AppComponent],
})
export class AppModule {}
my firebase database name is default as some thread suggested a non default name will cause problem, the same is working fine on iOS.
my package.json is as follows
{
"name": "baniya",
"version": "0.0.1",
"author": "Moblize.it LLC",
"homepage": ";,
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/common": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/fire": "^7.5.0",
"@angular/forms": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"@capacitor-community/apple-sign-in": "^7.0.0",
"@capacitor/android": "7.0.1",
"@capacitor/app": "7.0.0",
"@capacitor/browser": "7.0.0",
"@capacitor/core": "^7.0.1",
"@capacitor/haptics": "7.0.0",
"@capacitor/ios": "7.0.1",
"@capacitor/keyboard": "7.0.0",
"@capacitor/network": "^7.0.0",
"@capacitor/status-bar": "7.0.0",
"@capgo/capacitor-social-login": "^1.2.6",
"@googlemaps/js-api-loader": "^1.16.8",
"@ionic/angular": "^7.0.0",
"chart.js": "^4.3.0",
"chartjs-gauge": "^0.3.0",
"chartjs-plugin-datalabels": "^2.2.0",
"firebase": "^9.22.2",
"ionicons": "^7.0.0",
"moment": "^2.29.4",
"rxjs": "~7.5.0",
"swiper": "^9.3.2",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.0",
"@angular-eslint/builder": "^15.0.0",
"@angular-eslint/eslint-plugin": "^15.0.0",
"@angular-eslint/eslint-plugin-template": "^15.0.0",
"@angular-eslint/schematics": "^15.0.0",
"@angular-eslint/template-parser": "^15.0.0",
"@angular/cli": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@angular/language-service": "^15.0.0",
"@capacitor/assets": "^2.0.4",
"@capacitor/cli": "^7.0.1",
"@ionic/angular-toolkit": "^9.0.0",
"@types/google.maps": "^3.58.1",
"@types/jasmine": "~4.0.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~4.3.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"ts-node": "~8.3.0",
"typescript": "^4.8.4"
},
"description": "Baniya App by Moblize.it LLC"
}