amazon-web-services - 使用 AWS SAM 的 AWS Lambda 函数在 3 秒后超时
问题描述
我是 AWS 和 Go 的新手,我正在尝试通过 AWS SAM CLI 执行我的 Lambda 函数。但是每次我尝试这样做时,都会出现以下错误:
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:
我不想复制我在 HTTP 请求中传递的信息,因为它很敏感。
知道如何修改这个 3 秒超时吗?
解决方案
Lambda 函数的默认超时时间为 3 秒。您可以通过更新SAM 模板中的Timeout属性来设置任何值,例如
ExampleLambda:
Type: AWS::Serverless::Function
Properties:
CodeUri: .
Handler: index.handler
Runtime: nodejs10.x
Timeout: 10
推荐阅读
- python - 创建数据框而不是从 API 调用中下载
- javascript - 根据用户输入显示数据
- r - RMarkdown 不在 RStudio 中打印块输出
- javascript - 如何获取复选框的值而不是 true
- ubuntu - 无法在 Ubuntu 20.04 的 dbeaver 的输入字段中输入任何内容
- java - 如何在使用 Jackson 时解析嵌套的 json 对象
- javascript - 为什么在将功能迁移到组件以提高可读性时 onChnage 不是一个功能
- java - 如何在android中保存类似的按钮状态?
- javascript - 从此 JS 输出中删除逗号“,”并使用换行符代替 , 逗号
- jquery - 更改日历中的语言 - dateTimePicker