aws-toolkit-jetbrains icon indicating copy to clipboard operation
aws-toolkit-jetbrains copied to clipboard

Template for deploying Serverless::Lambda fails when not using Serverless transform

Open crichey opened this issue 3 years ago • 2 comments

When deploying a lambda, the template fails to deploy via sam with the error: Unrecognized resource types: [AWS::Serverless::Function].

Template that is created is (redacted): Resources: Function: Type: AWS::Serverless::Function Properties: Timeout: 300 MemorySize: 128 Handler: helloworld.App CodeUri: s3://.....redacted Runtime: java11 Architectures: - x86_64 Metadata: SamResourceId: Function

Adding this header manually seems to solve the problem: AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31'

crichey avatar Aug 02 '22 14:08 crichey

I thought this was pretty well documented by CloudFormation, but it would be nice to have hints in the IDE when you try to use a AWS::Serverless resource without the appropriate transform declared

rli avatar Aug 02 '22 16:08 rli

Definitely some sort of hint or option to add that. The default path is to just select "create new aws lambda" from the Lambda menu and that leads to a template that isn't properly formed for deployment.

crichey avatar Aug 08 '22 19:08 crichey

Yes along with some clear way to change how the template is created. If the plug-in creates a template automatically it should use the right settings.

Sent from my iPhone

On Aug 2, 2022, at 12:40, Richard Li @.***> wrote:

 I thought this was pretty well documented by CloudFormation, but it would be nice to have hints in the IDE when you try to use a AWS::Serverless resource without the appropriate transform declared

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

crichey avatar Oct 11 '22 07:10 crichey