goal: provide time stamps when a record in 'job application' was updated.
I got an error when I added the following lines to my cloud function::
exports.touch = functions.database.ref('/job application/').onWrite(
(change, context) => admin.database().ref('/lastmodified').set(context.timestamp));
Here is the error:
Failed to load function definition from source: Failed to generate manifest from function source: Error: Missing expected firebase config value databaseURL, config is actually{"projectId":"XXXX","storageBucket":"XXXXX","locationId":"us-east4"}
If you are unit testing, please set process.env.FIREBASE_CONFIG
I am trying to add time stamps to the collection 'job application'.
I am trying to follow the following snip: https://github.com/firebase/functions-samples/blob/main/lastmodified-tracking/functions/index.js
CodePudding user response:
As mentioned in the error, you have to specify databaseURL
in your firebase configuration. URL’s are of form projectID.firebaseio.com
.
Here is the configuration example:
{
"projectId":"xxxxx",
"storageBucket":"xxxxx",
"locationId":"us-east4",
"databaseURL":"https://xxxxx.firebaseio.com"
}
Also check this StackOverflow Thread