I have three cloud functions, two of which have been deployed to my firebase project, one of which I've just added. I was hoping to test the new one locally before deploying, but when I try to use it I'm unable, and only the two already-deployed functions are useable.
Firebase emulator runs just fine on port 5001
, as per usual. I followed these instructions and added firebase.functions().useEmulator("localhost", 5001);
to the func I wanted to test locally:
already-deployed func example:
// index.js
exports.addMessage = functions.region("europe-west1").https.onRequest(...
not-yet-deployed func:
// index.js
exports.testFunction = functions.useEmulator("localhost", 5001).https.onRequest(...
Then I went to https://localhost:5001/{projectId}/us-central1/testFunction
, but the browser displayed a message saying only addMessage
and my other deployed func was available for use. I also tried http
, as was recommended in another thread.
Is there a step I'm missing here? Some kind of "local" deployment? I'm aware there's been some changes in firebase versions which could be messing things up, but I'm using the default imports/dependencies firebase installs when you run firebase init
:
// package.json
"dependencies": {
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1"
},
//index.js
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";