I am writing an express webserver using Firebase. However, it seems that I can't test my changes locally.

I am attempting to follow the documentation for testing cloud functions locally. But when I make changes locally, only the deployed version gets executed, not the local version.

In two separate shells, I am running:

firebase emulators:start --only functions and firebase serve --only hosting

Here is /functions/index.js

const functions = require('firebase-functions');
const express = require('express');
const app = express();

const cors = require('cors')({origin: true});
app.use(cors);

app.get('/myroute', (req, res) => {
    return res.send('hello1');
});

module.exports = {
    app: functions.https.onRequest(app),
};

When I modify 'hello1' to 'hello2', then save, restart both servers, and request localhost:5000/myroute in my browser, it still responds with hello1.

How can I get my local cloud function changes to appear when I request localhost:5000/myroute?

0 Answers