Search code examples
typescriptfirebasegoogle-cloud-functionsfirebase-cli

Firebase functions deployment not updating


I have my firebase functions set up across multiple files. For some reason when i deploy the changes are not being applied as though they are cached or something.

My folder structure is as follows:

functions/

scr/

index.ts
auth.ts
inventory.ts

Here is my index.ts:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const functions = require("firebase-functions");
const admin = require("firebase-admin");
exports.auth = require("./auth");
exports.inventory = require("./inventory");
admin.initializeApp();

auth.ts:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const auth_functions = require("firebase-functions");
exports.login = auth_functions.https.onRequest(
  (request: any, response: any) => {
    response.send("login");
  }
);

exports.logout = auth_functions.https.onRequest(
  (request: any, response: any) => {
    response.send("logout");
  }
);

inventory.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const inventory_functions = require("firebase-functions");
exports.getByLocation = inventory_functions.https.onRequest(
  async (request: any, response: any) => {
  response.send("inventory");
});

After i run

firebase deploy --only functions

Everything shows successful but i am not seeing changes in emulator or when i deploy. I also tried renaming/removing a function and the cli ignored it and just shows success. This is very frustrating considering logs tell me nothing and no error occurs.


Solution

  • Problem was in my package.json where path was wrong to index.js. Basically was building to a directory that was different then where i was deploying from. Just needed to update to

    "main": "lib/index.js",