简体   繁体   中英

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.

Here is my firebase.js file on the front end:

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:

{
  "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

npm install firebase-functions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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