Firebase Callable Function 在一个项目上工作,在另一个项目上抛出错误

Firebase Callable Function works on one project, throws Error on the other

在调用基本的可调用 Firebase 云函数后,我在 Ionic-Angular 应用程序(在 Chrome DevTool 中)得到 ERROR Error: internal .我的应用程序是 运行 在本地使用 ionic serve 命令。

import * as functions from "firebase-functions";

export const helloWorld = functions
  .region("europe-west2")
  .https.onCall((data, context) => {
    functions.logger.info("Hello logs!", { structuredData: true });
    return "Hello from Firebase!";
  });
this.AngularFireFunctions
        .httpsCallable("helloWorld")({})
        .toPromise()
        .then((r) => console.log(r));
app.component.ts:46 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:368)
    at Zone.run (zone-evergreen.js:130)
    at zone-evergreen.js:1272
    at ZoneDelegate.invokeTask (zone-evergreen.js:402)

为了查明问题,我在我的另一个 Ionic-Angular 项目上尝试了 运行 同样的事情。我以完全相同的方式(与上面相同的代码),在完全相同的位置(app.component.ts),使用相同版本的 AngularFire(^6.0.2)和 运行 以同样的方式(使用 ionic serve但它最终在第二个项目上工作!

Firebase 日志比较

我尝试对另一个云函数执行相同的过程,但无论我调用哪个函数,都会发生同样的事情:我在第一个项目中遇到内部错误,在第二个项目中成功调用了该函数。

我假设这意味着错误不可能是服务器端的,也不是我拨打电话的方式,但那是什么?我不知道现在该去哪里看!还有什么会起作用并可能导致此问题?有什么东西会干扰这个过程吗?任何帮助、提示或建议将不胜感激!

更新

我的同事从 GitHub 中提取了我的第一个项目版本,并且云函数 运行 正确地没有抛出 Error: Internal!我的项目会损坏还是什么?

我终于解决了这个问题!

我不得不删除我的 /node_modules 文件夹和 package-lock.json 文件 (/dist 也是个好主意,但我没有),然后 运行 npm install 重新安装所有依赖项并重建 package-lock.json 文件夹。

我过去会做的是删除/node_modules文件夹,据我现在的理解,package-lock.json保持不变并安装旧版本的依赖项,造成冲突,因此 ERROR: internal.