错误:调用Firebase https可调用的云函数时,新HttpsErrorImpl内部出现错误

问题描述

这是每当我调用manageSubscription()并调用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)

使用:

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

这是我的Apps模块:

@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开发人员控制台的“网络”标签中看不到对此功能的调用。我在做什么错了?

我尝试了云功能模拟器和实时应用程序。还是没有运气!

过去三天以来,我一直在尝试调试此方法,并且失去了一些头发和体重:/

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)