Open
Description
Operating System
MacOS 14.6.1
Environment (if applicable)
ionic
Firebase SDK Version
11.4.0
Firebase SDK Product(s)
Firestore
Project Tooling
ionic angular
Detailed Problem Description
running app on android fails to connect to firestore. on ios the same code works just fine. below is the log and package.json
2025-04-01 22:53:34.516 29524-29524 Capacitor/Console it.moblize.baniya W File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: [2025-04-02T03:53:34.516Z] @firebase/firestore: Firestore (11.4.0): WebChannelConnection RPC 'Write' stream 0x84a843af transport errored: [object Object]
2025-04-01 22:53:34.521 29524-29524 Capacitor/Console it.moblize.baniya D File: - Line 526 - Msg: CapacitorHttp fetch 1743566014267 [object Request]: 251.22412109375 ms
2025-04-01 22:53:34.522 29524-29524 Capacitor/Console it.moblize.baniya W File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: [2025-04-02T03:53:34.520Z] @firebase/firestore: Firestore (11.4.0): WebChannelConnection RPC 'Listen' stream 0x84a843ae transport errored: [object Object]
2025-04-01 22:53:34.522 29524-29524 Capacitor/Console it.moblize.baniya E File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: [2025-04-02T03:53:34.520Z] @firebase/firestore: Firestore (11.4.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-04-01 22:53:34.523 29524-29524 Capacitor/Console it.moblize.baniya I File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: error in loadCountryConfig in data.service.ts: FirebaseError: [code=unavailable]: Failed to get document because the client is offline.
2025-04-01 22:53:34.524 29524-29524 Capacitor/Console it.moblize.baniya I File: https://localhost/7758.70ac04d6f4c667a2.js - Line 1 - Msg: Country config is: undefined
2025-04-01 22:53:34.527 29524-29588 Capacitor it.moblize.baniya D Handling local request: https://localhost/7372.41508e720f337a55.js
2025-04-01 22:53:34.528 29524-29524 Capacitor/Console it.moblize.baniya E File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: ERROR FirebaseError: [code=unavailable]: Failed to get document because the client is offline.
2025-04-01 22:53:34.530 29524-29524 Capacitor/Plugin it.moblize.baniya V To native (Capacitor plugin): callbackId: 134029103, pluginId: CapacitorHttp, methodName: request
2025-04-01 22:53:34.530 29524-29524 Capacitor it.moblize.baniya V callback: 134029103, pluginId: CapacitorHttp, methodName: request, methodData: {"url":"https:\/\/firestore.googleapis.com\/google.firestore.v1.Firestore\/Write\/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=11343&CVER=22&X-HTTP-Session-Id=gsessionid&zx=9tstp351wfrr&t=1","method":"POST","data":"headers=X-Goog-Api-Client%3Agl-js%2F%20fire%2F11.4.0%0D%0AContent-Type%3Atext%2Fplain%0D%0AX-Firebase-GMPID%3A1%3A329500481487%3Aweb%3A7157d20dc5123abd4ea4ba%0D%0A&count=1&ofs=0&req0___data__=%7B%22database%22%3A%22projects%2Fbaniya-38d78%2Fdatabases%2F(default)%22%7D","dataType":"text","headers":{"Content-Type":"application\/x-www-form-urlencoded","content-type":"application\/x-www-form-urlencoded"}}
2025-04-01 22:53:34.532 29524-29681 CapacitorCookies it.moblize.baniya I Getting cookies at: 'https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=11343&CVER=22&X-HTTP-Session-Id=gsessionid&zx=9tstp351wfrr&t=1'
2025-04-01 22:53:34.536 29524-29588 Capacitor it.moblize.baniya D Handling local request: https://localhost/7240.cf85a73451ebfadb.js
2025-04-01 22:53:34.536 29524-29588 Capacitor it.moblize.baniya D Handling local request: https://localhost/8805.43397451a063ed4d.js
2025-04-01 22:53:34.543 29524-295
2025-04-01 22:54:34.024 29524-29681 CapacitorCookies it.moblize.baniya I Getting cookies at: 'https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=49772&CVER=22&X-HTTP-Session-Id=gsessionid&zx=ee5bfmfusowp&t=1'
2025-04-01 22:54:34.036 29524-29681 Capacitor/Plugin it.moblize.baniya E Unable to resolve host "firestore.googleapis.com": No address associated with hostname
2025-04-01 22:54:34.037 29524-29681 Capacitor it.moblize.baniya D Sending plugin error: {"save":false,"callbackId":"134029112","pluginId":"CapacitorHttp","methodName":"request","success":false,"error":{"message":"Unable to resolve host \"firestore.googleapis.com\": No address associated with hostname","code":"UnknownHostException"}}
2025-04-01 22:54:34.043 29524-29524 Capacitor/Console it.moblize.baniya D File: - Line 530 - Msg: CapacitorHttp fetch 1743566074012 [object Request]: 29.348876953125 ms
2025-04-01 22:54:34.045 29524-29524 Capacitor/Console it.moblize.baniya E File: https://localhost/polyfills.91aae63ddd436914.js - Line 1 - Msg: Error: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
2025-04-01 22:54:34.048 29524-29524 Capacitor/Console it.moblize.baniya W File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: [2025-04-02T03:54:34.047Z] @firebase/firestore: Firestore (11.4.0): WebChannelConnection RPC 'Write' stream 0x84a843ba transport errored: [object Object]
2025-04-01 22:55:13.030 29524-29524 Capacitor/Plugin it.moblize.baniya V To native (Capacitor plugin): callbackId: 134029113, pluginId: CapacitorHttp, methodName: request
2025-04-01 22:55:13.033 29524-29524 Capacitor it.moblize.baniya V callback: 134029113, pluginId: CapacitorHttp, methodName: request, methodData: {"url":"https:\/\/firestore.googleapis.com\/google.firestore.v1.Firestore\/Write\/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=9084&CVER=22&X-HTTP-Session-Id=gsessionid&zx=b1ytazxppbqz&t=1","method":"POST","data":"headers=X-Goog-Api-Client%3Agl-js%2F%20fire%2F11.4.0%0D%0AContent-Type%3Atext%2Fplain%0D%0AX-Firebase-GMPID%3A1%3A329500481487%3Aweb%3A7157d20dc5123abd4ea4ba%0D%0A&count=1&ofs=0&req0___data__=%7B%22database%22%3A%22projects%2Fbaniya-38d78%2Fdatabases%2F(default)%22%7D","dataType":"text","headers":{"Content-Type":"application\/x-www-form-urlencoded","content-type":"application\/x-www-form-urlencoded"}}
2025-04-01 22:55:13.043 29524-29681 CapacitorCookies it.moblize.baniya I Getting cookies at: 'https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=9084&CVER=22&X-HTTP-Session-Id=gsessionid&zx=b1ytazxppbqz&t=1'
2025-04-01 22:55:13.057 29524-29681 Capacitor/Plugin it.moblize.baniya E Unable to resolve host "firestore.googleapis.com": No address associated with hostname
2025-04-01 22:55:13.058 29524-29681 Capacitor it.moblize.baniya D Sending plugin error: {"save":false,"callbackId":"134029113","pluginId":"CapacitorHttp","methodName":"request","success":false,"error":{"message":"Unable to resolve host \"firestore.googleapis.com\": No address associated with hostname","code":"UnknownHostException"}}
2025-04-01 22:55:13.066 29524-29524 Capacitor/Console it.moblize.baniya D File: - Line 530 - Msg: CapacitorHttp fetch 1743566113019 [object Request]: 45.908935546875 ms
2025-04-01 22:55:13.067 29524-29524 Capacitor/Console it.moblize.baniya E File: https://localhost/polyfills.91aae63ddd436914.js - Line 1 - Msg: Error: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
2025-04-01 22:55:13.071 29524-29524 Capacitor/Console it.moblize.baniya W File: https://localhost/main.d388d25aeb71f83b.js - Line 1 - Msg: [2025-04-02T03:55:13.070Z] @firebase/firestore: Firestore (11.4.0): WebChannelConnection RPC 'Write' stream 0x84a843bb transport errored: [object Object]
2025-04-01 22:56:19.031 29524-29524 Capacitor/Plugin it.moblize.baniya V To native (Capacitor plugin): callbackId: 134029114, pluginId: CapacitorHttp, methodName: request
2025-04-01 22:56:19.034 29524-29524 Capacitor it.moblize.baniya V callback: 134029114, pluginId: CapacitorHttp, methodName: request, methodData: {"url":"https:\/\/firestore.googleapis.com\/google.firestore.v1.Firestore\/Write\/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=1430&CVER=22&X-HTTP-Session-Id=gsessionid&zx=sjjsdo2ibz0e&t=1","method":"POST","data":"headers=X-Goog-Api-Client%3Agl-js%2F%20fire%2F11.4.0%0D%0AContent-Type%3Atext%2Fplain%0D%0AX-Firebase-GMPID%3A1%3A329500481487%3Aweb%3A7157d20dc5123abd4ea4ba%0D%0A&count=1&ofs=0&req0___data__=%7B%22database%22%3A%22projects%2Fbaniya-38d78%2Fdatabases%2F(default)%22%7D","dataType":"text","headers":{"Content-Type":"application\/x-www-form-urlencoded","content-type":"application\/x-www-form-urlencoded"}}
2025-04-01 22:56:19.047 29524-29928 CapacitorCookies it.moblize.baniya I Getting cookies at: 'https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2Fbaniya-38d78%2Fdatabases%2F(default)&RID=1430&CVER=22&X-HTTP-Session-Id=gsessionid&zx=sjjsdo2ibz0e&t=1'
2025-04-01 22:56:19.060 29524-29928 Capacitor/Plugin it.moblize.baniya E Unable to resolve host "firestore.googleapis.com": No address associated with hostname
2025-04-01 22:56:19.061 29524-29928 Capacitor it.moblize.baniya D Sending plugin error: {"save":false,"callbackId":"134029114","pluginId":"CapacitorHttp","methodName":"request","success":false,"error":{"message":"Unable to resolve host \"firestore.googleapis.com\": No address associated with hostname","code":"UnknownHostException"}}
2025-04-01 22:56:19.068 29524-29524 Capacitor/Console it.moblize.baniya D File: - Line 530 - Msg: CapacitorHttp fetch 1743566179019 [object Request]: 47.537841796875 ms
Based on suggestions here is my code looks like:
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
],
My package.json looks like below:
{
"name": "baniya",
"version": "0.0.1",
"author": "Moblize.it LLC",
"homepage": "https://baniya.app/",
"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"
}
Steps and code to reproduce issue
just trying to build the app.