AWS lambda无服务器映像调整大小

时间:2017-02-20 12:23:32

标签: amazon-s3 aws-lambda image-resizing

我正在使用亚马逊lambda和Amazon API跟随下面提到的图像调整大小的教程。

https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway

完成所有步骤后,进行测试

http://YOUR_BUCKET_WEBSITE_HOSTNAME_HERE/blue_marble.jpg

显示所需的图像,但

http://YOUR_BUCKET_WEBSITE_HOSTNAME_HERE/300×300 / blue_marble.jpg

给出错误{“message”:“内部服务器错误”}

AWS lambda监视器显示以下日志。

2017-02-20T12:18:57.979Z c0265015-f766-11e6-932c-ebf25f098e89 {     “errorMessage”:“不支持您提供的授权机制。请使用AWS4-HMAC-SHA256。”,     “errorType”:“InvalidRequest”,     “堆栈跟踪”: [         “Request.extractError(/var/runtime/node_modules/aws-sdk/lib/services/s3.js:538:35)”,         “Request.callListeners(/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)”,         “Request.emit(/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)”,         “Request.emit(/var/runtime/node_modules/aws-sdk/lib/request.js:668:14)”,         “Request.transition(/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)”,         “AcceptorStateMachine.runTo(/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)”,         “/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10”         “请求。(/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)”,         “请求。(/var/runtime/node_modules/aws-sdk/lib/request.js:670:12)”,         “Request.callListeners(/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:115:18)”,         “Request.emit(/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)”,         “Request.emit(/var/runtime/node_modules/aws-sdk/lib/request.js:668:14)”,         “Request.transition(/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)”,         “AcceptorStateMachine.runTo(/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)”,         “/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10”         “请求。(/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)”     ] }

我做错了什么?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

我对节点不是很熟悉,但是我已经写了一篇关于如何做同样的文章但是在python中。如果你想结帐:

Resize image using lambda