Briefly describe the bug you are facing.
Serverless function definition with "EventInvokeConfig" section which should be supported according to the AWS Sam documentation leads to validiation and build error.
Provide steps to replicate.
TestFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/test
EventInvokeConfig:
DestinationConfig:
OnFailure:
Destination: !Ref TestDLQ
Type: SQS
MaximumEventAgeInSeconds: 60
MaximumRetryAttempts: 2
InvalidResourceException('TestFunction',_ 'property EventInvokeConfig not defined for resource of type AWS::Serverless::Function')]
Please provide command output with --debug flag set.
sam validate --profile ...
sam build
sam --version: 0.40.0Add --debug flag to command you are running
I'm facing the same issue.
sam validate command fails.
is this the problem of version??
OS: amazonlinux2
Linux 81d07b382f95 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# sam --version
SAM CLI, version 0.40.0
# testcase1.yaml
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: test
Resources:
testFunc:
Type: AWS::Serverless::Function
Properties:
Description: test
Runtime: python3.7
Handler: app.lambda_handler
CodeUri: ./src/test
Tracing: Active
# EventInvokeConfig:
# MaximumRetryAttempts: 0
# sam validate --template ./testcase1.yaml --debug
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
Translated template is:
AWSTemplateFormatVersion: 2010-09-09
Description: test
Resources:
testFunc:
Properties:
Code:
S3Bucket: bucket
S3Key: value
Description: test
Handler: app.lambda_handler
Role:
Fn::GetAtt:
- testFuncRole
- Arn
Runtime: python3.7
Tags:
- Key: lambda:createdBy
Value: SAM
TracingConfig:
Mode: Active
Type: AWS::Lambda::Function
testFuncRole:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Version: '2012-10-17'
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
- arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess
Type: AWS::IAM::Role
/tmp/testcase1.yaml is a valid SAM Template
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam validate', 'duration': 11766, 'exitReason': 'success', 'exitCode': 0, 'requestId': 'be406ff4-6764-4709-8e5e-5723f1eb9a37', 'installationId': '1941c3dd-c906-40e7-89c4-224a92535547', 'sessionId': 'f1cf6a4c-5a26-4f7e-bda9-d771eb1779b9', 'executionEnvironment': 'CLI', 'pyversion': '3.7.4', 'samcliVersion': '0.40.0'}}]}
HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
md5-0877425dfae2700b5a17b6162f77ae82
# testcase2.yaml
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: test
Resources:
testFunc:
Type: AWS::Serverless::Function
Properties:
Description: test
Runtime: python3.7
Handler: app.lambda_handler
CodeUri: ./src/test
Tracing: Active
EventInvokeConfig:
MaximumRetryAttempts: 0
md5-94f885de22a4626f48582d7c4054ee51
# sam validate --template ./testcase2.yaml --debug
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
Template provided at '/tmp/testcase2.yaml' was invalid SAM Template.
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam validate', 'duration': 5198, 'exitReason': 'InvalidSamTemplateException', 'exitCode': 1, 'requestId': 'a511578c-4030-4f25-9f9e-6c4ed1c679a7', 'installationId': '1941c3dd-c906-40e7-89c4-224a92535547', 'sessionId': '21623945-d91f-48f1-a311-4ce4793d5bef', 'executionEnvironment': 'CLI', 'pyversion': '3.7.4', 'samcliVersion': '0.40.0'}}]}
HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: [InvalidResourceException('testFunc', 'property EventInvokeConfig not defined for resource of type AWS::Serverless::Function')] ('testFunc', 'property EventInvokeConfig not defined for resource of type AWS::Serverless::Function')
#
I think the issue is due to aws-sam-cli 0.40.0 has requirement aws-sam-translator==1.19.1, but Lambda destinations support was included in aws-sam-translator==1.20.0 (https://github.com/awslabs/serverless-application-model/releases/tag/v1.20.0)
@tasiogr that's right! my aws-sam-translator was 1.19.1
after I upgrade it to 1.20.1 it's working with no error, thank you!
it seems already merged at #1680, right?
it seems already merged at #1680, right?
Yes, but it was merged after the latest release. It will be in the next release.
Is there any workaround for this?
It's been 3 weeks since 1.2 was released. How big a delay should we anticipate? I've got a template that is correct and works and deploys correctly, but I can't use with start local api.
Blocking local development for (as far as I can see) precisely zero benefit is rather frustrating.
My team is also blocked by this.
This was released with aws-sam-cli 0.41.0 yesterday afternoon, closing.
Most helpful comment
I think the issue is due to aws-sam-cli 0.40.0 has requirement aws-sam-translator==1.19.1, but Lambda destinations support was included in aws-sam-translator==1.20.0 (https://github.com/awslabs/serverless-application-model/releases/tag/v1.20.0)