Open
Description
After updating to firebase-functions 4.0.1
and trying to deploy the functions, firebase doesn't find any cloud functions anymore. It shows the following error:
The following functions are found in your project but do not exist in your local source code:
auth-onCreate(europe-west1)
…
If you are renaming a function or changing its region, it is recommended that you create the new function first before deleting the old one to prevent event loss. For more info, visit https://firebase.google.com/docs/functions/manage-functions#modify
? Would you like to proceed with deletion? Selecting no will continue the rest of the deployments. No
index.ts
import { exportFunctions } from 'better-firebase-functions';
import camelCase from 'camelcase';
exportFunctions({
__filename,
exports,
functionDirectoryPath: './api',
funcNameFromRelPath: myFuncNameAlgo,
});
function myFuncNameAlgo(relPath: string): string {
const sep = '/';
const relPathArray = relPath.split(sep); /* ? */
const fileName = relPathArray.pop(); /* ? */
const relDirPathFunctionNameChunk = relPathArray.map((pathFragment) => camelCase(pathFragment)).join(sep);
const fileNameFunctionNameChunk = camelCase(fileName!.split('.')[0]);
const funcName = relDirPathFunctionNameChunk ? `${relDirPathFunctionNameChunk}${sep}${fileNameFunctionNameChunk}` : fileNameFunctionNameChunk;
return funcName.split(sep).join('-');
}
With firebase-functions 3.24.1
deployment works and the functions are picked up correctly.
The transpiled JS files look as expected and correctly use exports.default
Sample function (TS->JS)
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const functions = __importStar(require("firebase-functions"));
exports.default = functions
.region('europe-west1')
.auth.user()
.onCreate((user) => {
…
return Promise.resolve();
});
Is there any way to debug what's going wrong?
Metadata
Assignees
Labels
No labels