我正在尝试创建一个“Hello, World”AWS Lambda 函数,但有一个小小的更改:我需要使用 .zip 文件来部署它。为了实现这一目标,我做了以下工作:
从终端窗口
使用初始化新的 AWS Lambda 函数dotnet new lambda.EmptyFunction --name myFirstFunction --profile default --region us-east-1
cd进入myFirstFunction
跑步dotnet publish ./src/myFirstFunction/myFirstFunction.csproj
导航到./src/myFirstFunction/bin/Debug/net6.0/publish
将所有文件压缩到一个名为Archive.zip.
从浏览器中的 AWS 控制台
导航到myFirstFunctionLambda 函数。
单击“代码源”部分中的“上传自 -> .zip 文件”
选择Archive.zip
成功上传后导航至“测试”选项卡
单击“测试事件”部分中的“测试”按钮
此时,我收到一条错误消息:
{
"errorType": "LambdaValidationException",
"errorMessage": "Could not find the specified handler assembly with the file name 'LambdaTest, Culture=neutral, PublicKeyToken=null'. The assembly should be located in the root of your uploaded .zip file.",
"stackTrace": …Run Code Online (Sandbox Code Playgroud)