This topic describes handlers and how to configure handlers in a custom runtime in Function Compute.

What is a handler?

A handler for a function in FC is the method that is used to process requests in function code. When a function in FC is invoked, Function Compute uses the handler that you configured to process requests. You can configure a handler by specifying a value for the Request Handler parameter in the Function Compute console.

For FC functions in a custom runtime, an HTTP server is implemented. Therefore, the handler configured for the function is useless in most scenarios. You can set the handler to a random valid string. You can use the x-fc-function-handler header in the logic of the HTTP server to obtain the handler configurations for custom processing.
Note The handlers for lifecycle hooks of a function instance, including the Initializer, PreFreeze, and PreStop hooks, can be configured in a similar way. For more information, see Common request headers in Function Compute.

For more information about the definitions and operations of functions in FC, see Manage functions.

Configure a handler

When you configure a handler, make sure that you follow the configuration specifications that are described in Function Compute. The configuration specifications vary based on the handler type.

Handlers are classified into event handlers and HTTP handlers. Event requests are generated by event sources, and HTTP requests are generated by HTTP triggers. For more information, see Function types.

For examples on how to configure a handler, see Event handlers and HTTP handlers.