- Documentation
Volcano Engine Function as a Service
Development Guide
Code development
Code development overview
Code development
Code development overview
Code development overview
veFaaS provides two deployment methods: code deployment and container image deployment. For details about container image deployment, see Native runtime. This topic introduces the basic concepts related to the coding of the code deployment method. handler function
The handler function typically includes an event parameter and a context parameter.
- event parameter: The trigger uses the event parameter to pass basic information about the triggering event to your handler function.
- context parameter: It is used to pass runtime information to your handler function.
initializer function
The initializer is the entry point for the function's initialization logic. If there is an initializer function, veFaaS will first invoke the initializer to complete function initialization and then invoke the handler to process the request. For instance-level global initialization within a single function, we recommend using the initializer function.
- If you passed in a non-empty initializer function, veFaaS will take over the management of the function's initialization process. After the function's server-side process has started (as determined by the Liveness probe), veFaaS sends control signals and invokes the initializer to execute the function's initialization logic, ensuring that the function initializes successfully. You can indicate an initialization failure by returning an error (or by a panic occurring during the initialization process). If the function initialization fails, the request result returns an initializer failure, and the request is not executed.
- Decouple function initialization from function server-side startup
- Failure of the Initializer will not cause repeated restarts of the function process. However, if initialization is performed in the main function or init function, any failure will prevent your function from starting properly on the server side. It will cause exceptions including repeated restarts or deployment failures.
- In scale-out scenarios, the data traffic scheduling logic of veFaaS will, as much as possible, only inject new traffic into the current instance after the function's initializer has been executed successfully, thereby ensuring smooth scale-out to the greatest extent possible.
Last updated: 2026.08.19 14:06:05