As a new function type, web function can be directly triggered by HTTP requests, breaking through the limit of JSON event format required by the current event function type. It has more flexible application scenarios and delivers a development experience much similar to that of native web services.
Web function focuses on optimization of web service scenarios and can directly send HTTP requests to URLs to trigger function execution. You can use SCF to develop web services or quickly migrate your local web framework to Tencent Cloud.
As a new type of SCF function, web function is billed in the same way as event function. Both of them are billed by the number of invocations, resource usage, and public network outbound traffic. For more information, please see Billing Overview.
A web function runs in the image environment built in it based on the standard programming language. You must create an executable file
scf_bootstrap to start your web server, and then package the file with your code files for deployment to create a web function. During actual request processing, your
scf_bootstrap file will start the service first, after which your web server will receive all HTTP requests by listening on the specified
9000 port, forward them to the backend service for logic processing, and return the responses to end users.
Currently, the standard SCF runtime environment image has been opened up. For directions on how to use it, please see Using Container Image. You can select an appropriate image tag for local development and testing based on your actual development scenario. Before deploying a web function, please make sure that your project can be normally started in the local image.
When an HTTP request is sent, certain header fields will be entered automatically by API Gateway and cannot be customized, because information exchange between the function and gateway has certain requirements and capability limits. Such fields mainly include the following:
You can quickly identify the cause of failure and find the solution based on the returned error code.
Contact our sales team or business advisors to help your business.
Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.
Was this page helpful?