aws-sam-cli
aws-sam-cli copied to clipboard
Bug: Property ScalingConfig not defined for resource of type SQS
Description:
I have a Lambda function triggered by an SQS event that has scaling configured. Example:
MyFunction:
Type: AWS::Serverless::Function
Properties:
...
Events:
MySQSEvent:
Type: SQS
Properties:
...
ScalingConfig:
MaximumConcurrency: 10
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-scalingconfig.html
The template is built and deployed successfully. The scaling works correctly. However, an error is raised when I try to publish the application to Serverless Application Repository.
Steps to reproduce:
- Create a SAM template with a Lambda function and SQS trigger with
ScalingConfig
property. - Add application metadata to the template (as it's going to be published to SAR).
- Package and try to publish the application.
$ sam package --output-template-file packaged.yaml
$ sam publish --template packaged.yaml
Observed result:
sam publish --debug --template packaged.yaml
2023-10-22 15:47:22,725 | Using SAM Template at /Users/user/Projects/app/packaged.yaml
2023-10-22 15:47:22,729 | Config file location: /Users/user/Projects/app/samconfig.toml
2023-10-22 15:47:22,730 | Loading configuration values from [default.['publish'].parameters] (env.command_name.section) in config file at
'/Users/user/Projects/app/samconfig.toml'...
2023-10-22 15:47:22,730 | Configuration values successfully loaded.
2023-10-22 15:47:22,731 | Configuration values are: {'stack_name': 'app'}
2023-10-22 15:47:22,750 | Using config file: samconfig.toml, config environment: default
2023-10-22 15:47:22,751 | Expand command line arguments to:
2023-10-22 15:47:22,751 | --template_file=/Users/user/Projects/app/packaged.yaml
Publish Failed
2023-10-22 15:47:23,992 | Failed to publish application to serverlessrepo
Traceback (most recent call last):
File "samcli/vendor/serverlessrepo/publish.py", line 44, in publish_application
File "botocore/client.py", line 535, in _api_call
File "botocore/client.py", line 980, in _make_api_call
botocore.errorfactory.BadRequestException: An error occurred (BadRequestException) when calling the CreateApplication operation: Invalid
Serverless Application Specification document. Number of errors found: 1. Errors: Resource with id [MyFunctionBatch] is invalid. property
ScalingConfig not defined for resource of type SQS
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "samcli/commands/publish/command.py", line 88, in do_cli
File "samcli/vendor/serverlessrepo/publish.py", line 49, in publish_application
samcli.vendor.serverlessrepo.exceptions.ServerlessRepoClientError: Invalid Serverless Application Specification document. Number of errors
found: 1. Errors: Resource with id [MyFunctionBatch] is invalid. property ScalingConfig not defined for resource of type SQS
2023-10-22 15:47:24,001 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-10-22 15:47:24,048 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-10-22 15:47:24,049 | Unable to find Click Context for getting session_id.
Error: Invalid Serverless Application Specification document. Number of errors found: 1. Errors: Resource with id [MyFunctionBatch] is invalid. property ScalingConfig not defined for resource of type SQS
Please follow the instructions in https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-publishing-applications.html
Expected result:
The app is successfully published.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: macOS 14.0
-
sam --version
: SAM CLI, version 1.95.0 - AWS region: eu-central-1
sam --info
{
"version": "1.95.0",
"system": {
"python": "3.8.13",
"os": "macOS-14.0-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "1.4.5"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
Hi @kamilturek, thanks for reporting the issue. I am able to reproduce the behavior. We will investigate this further and get back to you.
Has there been update on this issue? I am also experiencing this
This seems to be working for me now. Could you check if you are still having issues with the latest version of SAM CLI?
Closing as this seems to be fixed now and the issue has been inactive for a while. Feel free to open a new issue if you still have any questions or concerns.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.