i have a lot of firebase cloud functions with a timeout > 1m and every time I redeploy them it resets the timeout to 1m again. it takes a lot of time to always edit the timeout in the console after redeploying the functions. is there a way to set the timeout in the console or in the function itself?
exports.bgl = functions.pubsub
.schedule("*/10 7-18 * * 1-6")
.timeZone("Europe/Berlin")
.onRun(async (context) => {
const response = await fetch("https://www.bgl-zuerich.ch/vermietungen");
const body = await response.text();
const noFreeObjects = await body.search("Alle Wohnungen vermietet");
if (noFreeObjects === -1) {
sendEmail(
"<div><h1>object found for bgl</h1><a href='https://www.bgl-zuerich.ch/vermietungen'>Link</a>" +
body +
"</div>",
"[email protected]"
);
}
});
2
Answers
I don’t understand the relevance of the code you’re showing here. None of it looks like the complete code for a Cloud Functions. If you’re using the Firebase CLI to deploy your function, you can certainly set the timeout in the code that defines the function, and you should never have to changes it in the console. See the example in the documentation:
You can set the timeout for your Firebase Cloud Functions directly in the function’s code using the runWith method
This code may help you.