Closed manwithsteelnerves closed 3 years ago
Hi, I'm not sure if you're using a specific language (like Node), or asking a question in general in this generic repo.
The Functions Framework must target a function in your root directory to where you start the framework, like an index.js
file. It's common to have that index file refer/require to a nested folder like './common/external/database/triggers
.
You can also use FUNCTION_SOURCE
in some languages to target deep down the folders. However, I recommend 1 top-level index file to manage things.
LMK if that helps or please provide more details in the question including the language.
Thanks @grant for the reply! Yes, I'm using Node.
I was able to solve this by using '.' instead of '-'
"start": "cross-env FUNCTION_TARGET=triggers**.**level0CollectionDocumentOnWrite cross-env FUNCTION_SIGNATURE_TYPE=event functions-framework"
The confusion was because firebase creates the function names with '-'.
When working with functions, its quite common for having the function code maintained in a hierarchy. Currently my triggers code is not at the root source file but deep inside a hiearchy.
In the index, i refer it like this exports.triggers = require('./common/external/database/triggers');
I'm getting an error as below
Question
How to let functions framework detect the function whose source code is deep down the folders?