2017-01-13 14 views
2

我在swagger中收到「服務器沒有響應」的錯誤,lambda函數也沒有觸發,我在cloudwatch中看不到任何錯誤,好像我在post方法中有YAML文件的問題。 我花了2天的時間試圖瞭解這裏沒有結果,所以我會很感激任何幫助! 我YAML文件:如何在無服務器1.0中實現post方法?

pool-config: 
handler: dest/functions/pool-config/handler.execute 
events: 
    - http: 
     path: v1/config/pool 
     method: post 
     integration: lambda 
     request: 
     template: 
      application/json: '{ 
       "body": "$input.json(''$'')", 
       "functionAlias": "$stageVariables.functionAlias", 
       "principalId": "$context.authorizer.principalId", 
       "httpMethod": "$context.httpMethod"}' 
     response: 
     headers: 
      Content-Type: "'application/json'" 
      Access-Control-Allow-Origin: "'*'"   
     template: $input.path('$') 
     cors: 
     origins: 
      - '*' 
     headers: 
      - Content-Type 
      - X-Amz-Date 
      - Authorization 
     authorizer: authorizer 

回答

0

我找到了答案!!!!原因是在這一行"body": "$input.json(''$'')"我們應該使用它沒有像這樣的引號"body": $input.json(''$'')