Ionic 7 с Firebase на Android не может соединиться с FirestoreAndroid

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Ionic 7 с Firebase на Android не может соединиться с Firestore

Сообщение Anonymous »

После просмотра всех тем и предложений, для меня я все еще получаю ошибку. Добавление ExperimentalForCelongPolling: True не помог. Я тоже устал другой флаг без удачи. < /P>
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:

Код: Выделить всё

: 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: https://firestore.googleapis.com/google.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}
< /code>
my app.module.ts выглядит ниже: < /p>
const firebaseConfig = {
databaseURL: 'https://XXX.firebaseio.com',
apiKey: "XXXX",
authDomain: "XXX.firebaseapp.com",
projectId: "XXX-38d78",
storageBucket: "XXX-38d78.appspot.com",
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 {}
< /code>
Имя базы данных Firebase - по умолчанию, так как некоторые поток предположили, что имя не по умолчанию вызовет проблему, то же самое работает нормально на iOS.{
"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"
}
 

Подробнее здесь: [url]https://stackoverflow.com/questions/79474685/ionic-7-with-firebase-on-android-fails-to-connect-with-firestore[/url]
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»