简体   繁体   English

Firebase 调用模拟器时发生内部错误 function

[英]Firebase Functions internal error when calling emulator function

I am trying to connect my Expo project with Firebase Function's local emulator, but I keep getting an internal error whenever I try to call a function.我正在尝试将我的 Expo 项目与 Firebase 函数的本地仿真器连接起来,但是每当我尝试调用 function 时,我都会遇到internal错误。

Here is my firebase.js file on the front end:这是我在前端的firebase.js文件:

import firebase from "firebase";
import "firebase/firestore";
import "firebase/functions";
import {
  FIREBASE_API_KEY,
  FIREBASE_AUTH_DOMAIN,
  FIREBASE_DATABASE_URL,
  FIREBASE_PROJECT_ID,
  FIREBASE_STORAGE_BUCKET,
  FIREBASE_MESSAGING_SENDER_ID,
  FIREBASE_APP_ID,
  FIREBASE_MEASUREMENT_ID,
} from "@env";

// initialize firebase config
const config = {
  apiKey: FIREBASE_API_KEY,
  authDomain: FIREBASE_AUTH_DOMAIN,
  databaseURL: FIREBASE_DATABASE_URL,
  projectId: FIREBASE_PROJECT_ID,
  storageBucket: FIREBASE_STORAGE_BUCKET,
  messagingSenderId: FIREBASE_MESSAGING_SENDER_ID,
  appId: FIREBASE_APP_ID,
  measurementId: FIREBASE_MEASUREMENT_ID,
};

firebase.initializeApp(config);

firebase.functions().useFunctionsEmulator("http://localhost:5001");

export { firebase };

Here's my firebase.json file on back-end:这是我在后端的firebase.json文件:

{
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ]
  },
  "emulators": {
    "functions": {
      "port": 5001
    }
  }
}

Any ideas what this might be, or how I may be able to read into the error a little more?任何想法这可能是什么,或者我如何能够更多地阅读错误?

I ended up updating firebase functions using the command below in my functions/ directory我最终在我的functions/目录中使用以下命令更新了 firebase 函数

npm install firebase-functions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM