This topic describes the structural features, instance usage, and FAQ of event handlers in a custom runtime.
Background information
context
parameter in an official runtime based on the information in common headers. You can also build an input parameter similar to the event
parameter in an official runtime based on the request body of the invoked function.

Function invocation
If the function uses an event handler, the HTTP server needs to only implement the
logic that corresponds to the /invoke
path and the POST
method.
Path | Request | Expected response |
---|---|---|
POST /invoke |
|
Response body: the return value of the function handler. The return value includes
the response code and response header.
You can include the
x-fc-status field in response headers to report whether the local function is invoked to Function Compute.
Note We recommend that you specify the
StatusCode and x-fc-status fields in the HTTP response.
|
Examples
PHP
Go
Node.js
Python
Ruby
C++
TypeScript
Powershell
Lua
Dart
Rust
FAQ
- Must the listening port of a custom runtime be the same as that of the HTTP server of the custom runtime?
- What do I do if the FunctionNotStarted error occurs when I invoke a third-party service in a service started in a custom runtime?
- What do I do if the HTTP server I created fails to start within 120s?
- What do I do if the "Process exited unexpectedly before completing request" message is returned?
- What do I do if a 404 error occurs when I use a browser or the cURL tool to access a function?