'in <string>' 需要字符串作为左操作数,而不是 int

问题描述 投票:0回答:1

我正在尝试设置 github 操作以在推送到 main 时自动部署 lambdas,但是当我运行时

aws lambda create-function --function-name "helloWorld" --runtime nodejs20.x --role arn:aws:iam:... --handler "helloWorld.handler" --code fileb://helloWorld.zip
我不断收到错误消息
'in <string>' requires string as left operand, not int
zip 文件只包含 helloworld.js 刚刚有
export const handler = async (event) => { const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; };

(如果有帮助,请使用

zip -r "helloWorld.zip" ".\helloWorld.js"
制作 zip 文件)

我尝试将命令更改为

aws lambda create-function --function-name "helloWorld" --runtime nodejs20.x --role arn:aws:iam... --handler "helloWorld.handler" --code file://helloWorld.zip

但这只是给出了一个错误

Error parsing parameter '--code': Unable to load paramfile (helloWorld.zip), text contents could not be decoded.  If this is a binary file, please use the fileb:// prefix instead of the file:// prefix.

javascript amazon-web-services aws-lambda aws-cli
1个回答
0
投票

要使用 zip 文件作为 lambda 代码,您需要使用 --zip-file myfile.zip 而不是 --code myfile.zip

© www.soinside.com 2019 - 2024. All rights reserved.