How To Handle SCF Execution Timeout?
The client will directly disconnect and report an error upon timeout. It is recommended to control the function execution time and avoid placing time-consuming operations in SCF directly called by the client.
How To Use Built-In Modules In Cloud Functions?
The built-in modules of cloud functions are integrated into the runtime environment and can be used directly.
If the version of the built-in module does not meet the requirements, you can install the module into the cloud function yourself, and it will be used by default.
Note:
The currently supported built-in module is request 2.87.1.
What To Do If Long-Time Processing Is Needed In SCF Execution?
To ensure the client experience, direct calls to long-duration SCF are not allowed.
It is recommended to adjust the required timeout (up to 20s) in the cloud console, and use callback() to return success in SCF, so the client does not wait for the execution result.
SCF will continue to execute within the timeout until completion or timeout, write the execution result into storage services such as databases, and then the client can retrieve the result.
Why Does the Cloud Function Return Exit Status 11 During Update?
Please check the packaging method and entry method of the function.
When creating SCF, the default execution method is index.main, with the entry file being index.js, and index.js must expose the main method using export.
When updating SCF, if you choose to upload using a zip package, pay attention to the packaging method. Ensure that the first-level content after unzipping the zip package must include the entry file (a common packaging error is placing the SCF code in a folder and compressing this folder, resulting in an unzipped folder that does not contain the entry file index.js).
Are Some Logs Missing During the Cloud Function Test?
When testing SCF with synchronized invocation (timeout less than 20 seconds), the returned logs are up to 4k. Logs exceeding 4k are not displayed.
If using asynchronous invocation (timeout greater than or equal to 20 seconds), the returned logs are up to 6M. Logs exceeding 6M are not displayed.