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>",
"cornelia.scherrer@tecfox.ch"
);
}
});
You can set the timeout for your Firebase Cloud Functions directly in the function’s code using the runWith method
const functions = require('firebase-functions');
exports.bgl = functions
.runWith({ timeoutSeconds: 540 }) // Set timeout to 9 minutes (540 seconds)
.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>",
"cornelia.scherrer@tecfox.ch"
);
}
});
This code may help you.