doujiene2845
2019-05-17 08:07
浏览 183
已采纳

使用AWS SAM 3秒后AWS Lambda函数超时-GoLang

I am new to AWS and GoLang and I am trying to execute my Lambda function via AWS SAM cli. But everytime I try to do so I get the following error:

I0517 07:51:11.052078      13 main.go:62] Thumbnail Lambda successfully started 
I0517 07:51:13.696304      13 utils.go:99] Needed directories successfully created
2019-05-17 09:51:14 Function 'Thumbnail' timed out after 3 seconds
2019-05-17 09:51:14 Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received:

I did not want to copy information I pass in the HTTP request since its sensitive.

Any idea how I can modify this 3 second timeout?

图片转代码服务由CSDN问答提供 功能建议

我是AWS和GoLang的新手,我正尝试通过AWS SAM cli执行Lambda函数。 但是每次尝试这样做时,都会出现以下错误:

  I0517 07:51:11.052078 13 main.go:62] Thumbnail Lambda成功启动了
I0517 07:51:  13.696304 13 utils.go:99]成功创建了所需的目录
2019-05-17 09:51:14函数“缩略图”在3秒后超时
2019-05-17 09:51:14函数返回了无效响应(必须 在响应对象中包括以下内容之一:正文,标头或statusCode)。 收到响应:
   
 
 

我不想复制HTTP请求中传递的信息,因为它很敏感。

您知道如何修改这3秒钟的超时时间吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongtangu8403 2019-05-17 08:38
    已采纳

    I am using template.yml in order to set up my lambda. I forgot to re-build and re-run sam local start-api when I introduced Timeout property to it. Honest mistake, thank you for your time.

    打赏 评论
  • doucheng9634 2019-05-17 21:10

    The default timeout of Lambda functions is 3 seconds. You can set any value by updating the Timeout property in your SAM template, e.g.

    ExampleLambda:
      Type: AWS::Serverless::Function
      Properties:
        CodeUri: .
        Handler: index.handler
        Runtime: nodejs10.x
        Timeout: 10
    
    打赏 评论

相关推荐 更多相似问题