小编Den*_*hew的帖子

AWS Lambda 上的 cURL 给出了未找到命令的错误

从今天开始几个小时,Lambda 上的一个简单 curl 命令失败了。
Lambda 环境是 NodeJs 10.x(在 12.x 中也尝试过)。

const { execSync } = require('child_process');

exports.handler = async (event) => {
   execSync('curl http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg -o /tmp/BigBuckBunny.jpg');
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    };
    return response;
};
Run Code Online (Sandbox Code Playgroud)

我收到一个 /bin/sh curl: command not found 错误知道这是什么问题吗?

Response:
{
  "errorType": "Error",
  "errorMessage": "Command failed: curl http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg -o /tmBigBuckBunny.jpg\n/bin/sh: curl: command not found\n",
  "trace": [
    "Error: Command failed: curl http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg -o /tmBigBuckBunny.jpg",
    "/bin/sh: curl: command not found",
    "",
    "    at checkExecSyncError …
Run Code Online (Sandbox Code Playgroud)

curl aws-lambda

3
推荐指数
1
解决办法
4142
查看次数

标签 统计

aws-lambda ×1

curl ×1