【问题标题】:Error: internal at new HttpsErrorImpl when invoking Firebase https callable cloud functions [duplicate]错误:调用 Firebase https 可调用云函数时在新的 HttpsErrorImpl 内部 [重复]
【发布时间】:2021-01-20 18:21:25
【问题描述】:

这是我每次调用调用 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 天以来,我一直在尝试调试此问题,并且已经失去了一些头发和体重:/

【问题讨论】:

    标签: angular firebase google-cloud-functions angularfire


    【解决方案1】:

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

    【讨论】:

    猜你喜欢
    • 2020-11-24
    • 2020-07-07
    • 2020-05-13
    • 2021-08-29
    • 2020-10-06
    • 1970-01-01
    • 2023-02-16
    • 1970-01-01
    • 2020-05-29
    相关资源
    最近更新 更多