Update: I updated the question, to reflect what I described in the body of the question, and what was happening at the time. It also justifies why I did not mark Sanyam's response as correct. There was a bug in the Console that was causing the timeout values to be ephemeral. @MichaelBleigh's response was the most pertinent, letting me know when the issue was resolved.
I have a Cloud Function that needs to run past the default 60 second timeout in some edge-cases.
The issue is, while this value can be changed in the Cloud Functions section of the Google Cloud Developer Console, it reverts to the original default after each deploy.
Is there a way I can persist the changes to this setting, perhaps in one of the Firebase configuration files?
1 Navigate to your project: console.cloud.google.com/functions/…>. 2. Click "Edit" to adjust Timeout.
Cloud Functions deployment can fail if the entry point to your code, that is, the exported function name, is not specified correctly. Your source code must contain an entry point function that has been correctly specified in your deployment, either via Cloud console or Cloud SDK.
To set memory allocation and timeout in functions source code, use the runWith parameter introduced in Firebase SDK for Cloud Functions 2.0.0. This runtime option accepts a JSON object conforming to the RuntimeOptions interface, which defines values for timeoutSeconds and memory .
The Firebase CLI creates a .zip archive of the function code, which is then uploaded to a Cloud Storage bucket (prefixed with gcf-sources) in your Firebase project. Cloud Build retrieves the function code and builds the function source.
Please try again later. Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.
Time Zone of Cloud Functions for Firebase Scheduler does not change I am currently creating and deploying a function to be executed periodically in the Cloud Functions for Firebase scheduler as shown below. The key point is that I want it to be executed every day at 0:05 Japan time as .timeZone (‘Asia/Tokyo’).
Default timeout can be changed here https://console.cloud.google.com/functions/listselect function
>test function
> edit
> timeout
Starting functions v2.0.0 you can also set the timeout in your function declaration as described in the doc under the "Set timeout and memory allocation" section:
const runtimeOpts = {
timeoutSeconds: 300,
memory: '1GB'
}
exports.myStorageFunction = functions
.runWith(runtimeOpts)
.storage
.object()
.onFinalize((object) = > {
// do some complicated things that take a lot of memory and time
});
As release notes also highlighted:
You will need firebase-tools >=v4.0.0.
And on Mac you can get the latest firebase-tools
with the following command:
npm install -g firebase-tools
Also note the limitations and valid values as per the doc link above:
The maximum value for timeoutSeconds is 540, or 9 minutes.
Valid values for memory are:
128MB
256MB
512MB
1GB
2GB
4GB
8GB
After you select your function and then press "Edit" it is located under the "More" drop-down at the bottom of the page. The current max is 540 seconds.
Per @MichaelBleigh's comment. This has been resolved in the latest version of the Firebase CLI (3.7.0 at the time of this post).
If you are still experiencing this issue, make sure you are using the latest version of the Firebase CLI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With