Functions
If you are using Huawei Cloud FunctionGraph as a provider, all functions inside the service are Huawei Cloud FunctionGraph functions.
Configuration
# serverless.yml
service: fg-service
provider:
  name: huawei
plugins:
  - serverless-huawei-functions
functions:
  first:
    handler: index.handler
  Handler
The handler attribute should be the function name you have exported in your handler file.
// index.js
exports.handler = (event, context, callback) => {};
  Memory Size and Timeout
The memorySize and timeout for the functions can be specified at the provider or function level. The provider definition enables all functions to share this configuration, whereas the function definition indicates that this configuration is only valid for the function.
# serverless.yml
provider:
  memorySize: 512
  timeout: 90
functions:
  first:
    handler: first
  second:
    handler: second
    memorySize: 256
    timeout: 60
  Handler Signature
function (event, context) { }
  - event
    If the function is triggered by an APIG event specified, the event passed to the handler will be: // JSON.parse(event) { events: { "body": "", "requestContext": { "apiId": "xxx", "requestId": "xxx", "stage": "RELEASE" }, "queryStringParameters": { "responseType": "html" }, "httpMethod": "GET", "pathParameters": {}, "headers": { "accept-language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2", "accept-encoding": "gzip, deflate, br", "x-forwarded-port": "443", "x-forwarded-for": "xxx", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "upgrade-insecure-requests": "1", "host": "xxx", "x-forwarded-proto": "https", "pragma": "no-cache", "cache-control": "no-cache", "x-real-ip": "xxx", "user-agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0" }, "path": "/apig-event-template", "isBase64Encoded": true } }
- context
    The context parameter contains the runtime information about the function. For example, request ID, temporary AK, and function metadata. See Developing an Event Function. 
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot 
    