Error: internal at new HttpsErrorImpl when invoking Firebase https callable cloud functions

Error: internal at new HttpsErrorImpl when invoking Firebase https callable cloud functions

这是我每次调用调用 https 可调用云函数的 manageSubscription() 时遇到的错误:

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)

使用:

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

这是我的应用程序模块:

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

我正在我的服务中调用 https 可调用云函数:

添加的依赖项:

constructor(private firebaseFunctions: AngularFireFunctions) {}

这是方法:

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

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

这是云函数:

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 };
});

我在云功能日志或 chrome 开发控制台网络选项卡中看不到对该功能的调用。我做错了什么?

我尝试了云函数模拟器和实时应用程序。仍然没有运气!

自从过去 3 天以来,我一直在尝试对此进行调试,并且掉了一些头发和体重:/

您不是唯一因为这个问题而脱发的人。 我通过简单地更新客户端中的 firebase 包解决了(我周五做了同样的事情,但还没有解决) 版本7.22.0被魔鬼编码,升级到7.22.1,希望你没事。