Kesalahan: internal di HttpsErrorImpl baru saat menjalankan fungsi cloud callable https Firebase [duplikat]

Oct 06 2020

Ini adalah kesalahan yang saya dapatkan setiap kali saya memanggil manageSubscription () yang memanggil fungsi cloud callable https:

core.js:4081 ERROR Error: internal
    at new HttpsErrorImpl (index.cjs.js:60)
    at _errorForResponse (index.cjs.js:155)
    at Service.<anonymous> (index.cjs.js:560)
    at step (tslib.es6.js:100)
    at Object.next (tslib.es6.js:81)
    at fulfilled (tslib.es6.js:71)
    at ZoneDelegate.invoke (zone-evergreen.js:364)
    at Object.onInvoke (core.js:27149)
    at ZoneDelegate.invoke (zone-evergreen.js:363)
    at Zone.run (zone-evergreen.js:123)

Menggunakan:

"@angular/core": "^10.0.4",
"@angular/fire": "^6.0.3",

Ini Modul Aplikasi saya:

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    AngularFireModule.initializeApp(environment.firebaseConfig),
    AngularFireFunctionsModule,
    SharedComponentsModule,
    AppRoutingModule
  ],
  providers: [
    { provide: ORIGIN, useValue: 'http://localhost:5001' }
  ],
  bootstrap: [AppComponent]
})

Saya menjalankan fungsi cloud callable https di Layanan saya:

Ketergantungan yang ditambahkan:

constructor(private firebaseFunctions: AngularFireFunctions) {}

Ini caranya:

public manageSubscription(){
  this.firebaseFunctions.useFunctionsEmulator('http://localhost:5001');

  const functionRef = this.firebaseFunctions.httpsCallable('testFunction');
  functionRef({ returnUrl: 'window.location.origin' })
    .subscribe(response => {
      console.log(response);
  });
}

Ini adalah fungsi cloud:

import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';

admin.initializeApp();

exports.testFunction = functions.https.onCall((data, context) => {
    console.log('reached');
  return { date: true };
});

Saya tidak dapat melihat panggilan yang dilakukan ke fungsi ini di log fungsi cloud atau di tab Jaringan konsol dev chrome. Apa yang saya lakukan salah?

Saya mencoba emulator fungsi cloud dan aplikasi langsung. Masih belum berhasil!

Saya telah mencoba men-debug ini sejak 3 hari terakhir dan kehilangan sedikit rambut dan berat: /

Jawaban

4 MartinU Oct 06 2020 at 08:16

Anda bukan satu-satunya yang kehilangan rambut karena masalah ini. Saya menyelesaikannya hanya dengan memperbarui paket firebase di klien (saya melakukan hal yang sama pada hari Jumat tetapi belum terpecahkan) Versi 7.22.0 dikodekan oleh iblis, tingkatkan ke 7.22.1 dan semoga Anda akan baik.