标签: aws-toolkit

如何将 PATH 导出到“sam build”命令?

我正在 PyCharm 上开发 AWS Lambda 函数。当我执行“运行”按钮时,出现以下错误消息。

/usr/local/bin/sam build MyFunction --template /Users/miyashiiii/Works/myapp/myapp/template.yaml --build-dir /Users/miyashiiii/Works/myapp/myapp/.aws-sam/build
Building codeuri: myapp/ runtime: python3.7 metadata: {} functions: ['MyFunction']

Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations  : ['/usr/bin/python'] which did not satisfy constraints for runtime: python3.7. Do you have python for runtime: python3.7 on your PATH?
Run Code Online (Sandbox Code Playgroud)

python3.7 在我的 PATH 上,其他一些位置在我的 PATH 上,但位置列表仅包含“/usr/bin/python”。

当我在终端上执行相同的命令(/usr/local/bin/sam build ~~)时,它成功了。

如何将 PATH 导出到“sam build”命令?

amazon-web-services pycharm aws-lambda aws-sam-cli aws-toolkit

9
推荐指数
2
解决办法
3890
查看次数

IntelliJ IDEA Config cant find AWS Lambda Handler in Default 'helloworld' Application

When setting the debug configurations for the default IntelliJ IDEA Java helloworld application (created upon making a new AWS Lambda project) the following response is shown:

Error: Cannot find handler 'helloworld.App::handleRequest' in project."

To fix this I've tried editing 'Handler' element inside template.yaml to include a filepath, though there had been no success.

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: HelloWorldFunction
      Handler: helloworld.App::handleRequest
Run Code Online (Sandbox Code Playgroud)

I noticed the Python AWS Lambda helloworld project (within the PyCharm counterpart) required me to change the root …

java intellij-idea aws-lambda aws-sam-cli aws-toolkit

8
推荐指数
1
解决办法
810
查看次数

serverless.template 在 Visual Studio 中支持 yaml 吗?

我使用提供的模板创建了一个 aws lambda .net 核心项目

我有一个json文件serverless.template。SAM 模板现在可以在 yaml 中,我更喜欢它,因为它是可读的并且可以有注释。

当我将 serverless.template 更改为 yaml 时,visual studio 无法再读取它。这是否受支持,是否有配置来修复它?

amazon-web-services visual-studio aws-lambda asp.net-core aws-toolkit

6
推荐指数
0
解决办法
162
查看次数

在本地 IntelliJ 中使用 Java 运行 AWS Lambda - 函数调用容器没有响应(Docker 有问题?)

我在运行 AWS Lambda 时收到此错误No response from invoke container for Function。我希望它返回我定义为输出的“hello world”字符串:

错误

我也用这个更简单的 Lambda 函数尝试过,但得到了同样的错误:

public class App implements RequestHandler<String, String> {

    public String handleRequest(final String input, final Context context) {
            return "H";
    }
    
}
Run Code Online (Sandbox Code Playgroud)

我在本地启动 Docker 以使用 Docker 快速启动终端运行此 Lambda:

我的 docker 快速启动终端

我可能还需要在 Docker 中做其他事情吗?

这就是我使用 IntelliJ 插件 AWS Toolkit 创建新的 AWS Lambda 项目的方法:

  1. 文件 -> 新项目:

新项目

并选择以下设置:

设置

  1. 创建的项目有很多错误(无法解析符号“字符串”等)。我能够通过删除 .idea 文件夹来解决错误,然后单击文件 -> Invalidate Caches and Restart

错误

然后项目正确加载,但我没有在我的 App 类旁边看到 Lambda 符号:

缺少 Lambda 符号

  1. 所以我转到 pom.xml,右键单击,然后Import as Maven project. 这有效,我现在看到 …

amazon-web-services docker aws-lambda aws-toolkit

5
推荐指数
1
解决办法
3218
查看次数

发布到 AWS Lamba - 找不到“build-lambda-zip”实用程序

我目前正在尝试使用 Visual Studio 2019 社区 (v4.8.03752) 并利用 AWS Toolkit for Visual Studio (v1.20.1.0) 发布我的 AWS lambda 函数。右键单击我的项目并选择“发布到 AWS Lambda”后,我收到以下错误:

- Zipping publish folder C:\Users\Matt\source\repos\programName\programName\.\bin\Release\netcoreapp3.1\publish to C:\Users\Matt\AppData\Local\Temp\HelloWorld-CodeUri-Or-ImageUri-637489827969959200.zip
- Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
- Error packaging up project in C:\Users\Matt\source\repos\programName\programName\. for CloudFormation resource HelloWorld: Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
Run Code Online (Sandbox Code Playgroud)

在过去的几个月里,我已经能够多次部署这个,直到 2/12 星期五我开始收到这个错误(重新启动后)。更奇怪的是,如果我卸载AWS Toolkit …

aws-lambda aws-toolkit visual-studio-2019

4
推荐指数
1
解决办法
567
查看次数