serverless-frameworkaws-serverlessaws-http-api

Defining API path with query string Serverless HTTP API (API Gateway v2)


How can I define the path in serverless.yml with more than one query parameter using HTTP API (API Gateway v2) so that the endpoint looks like the following:

https://example.com/rest/endpoint?id=$id&tag=$tag

serverless.yml

 dfsPostback: 
    handler:  handlers/result.main 
    events:
      - httpApi:
          path: /dfs-pingback  // need help here 
          method: get

I tried with

path: /dfs-pingback?id={id}&tag={tag}

deployment failed


Solution

  • There is no need to specify the query parameters in the path. You should be able to access all passed query params in your event handler.