Starting Build use cache
2024-07-05 08:13:52 Plugin 'ServerlessAppPlugin' raised an exception: 'list' object has no attribute 'get'
Traceback (most recent call last):
File "samtranslator/plugins/sam_plugins.py", line 130, in act
File "samtranslator/metrics/method_decorator.py", line 116, in wrapper_cw_timer
File "samtranslator/plugins/application/serverless_app_plugin.py", line 124, in on_before_transform_template
File "samtranslator/sdk/template.py", line 34, in iterate
File "samtranslator/sdk/resource.py", line 26, in __init__
AttributeError: 'list' object has no attribute 'get'
Error: 'list' object has no attribute 'get'
Traceback:
File "click/core.py", line 1055, in main
File "click/core.py", line 1657, in invoke
[...]
File "samcli/lib/samlib/wrapper.py", line 73, in run_plugins
File "samcli/lib/samlib/wrapper.py", line 130, in parse
File "samtranslator/plugins/sam_plugins.py", line 136, in act
File "samtranslator/plugins/sam_plugins.py", line 130, in act
File "samtranslator/metrics/method_decorator.py", line 116, in wrapper_cw_timer
File "samtranslator/plugins/application/serverless_app_plugin.py", line 124, in on_before_transform_template
File "samtranslator/sdk/template.py", line 34, in iterate
File "samtranslator/sdk/resource.py", line 26, in __init__
An unexpected error was encountered while executing "sam build".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20build%20-%20AttributeError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20build%20-%20AttributeError
Description
The SAM CLI fails to parse templates using the
ForEachintrinsic function to define resources. The build first fails inaws-sam-translatorcode.Comments in a similar issue reported in the
sam-cliproject (aws/aws-sam-cli#5647) point to a fix recently merged in AWS CLI (aws/aws-cli#8096). Applying similar changes in bothaws-sam-translator(see #3636) andaws-sam-clion a local test environment fixes the issue.Steps to reproduce
Run
sam buildwith the example provided in the function reference documentationObserved result
The command fails in
aws-sam-translatorcode with the following traceback:Expected result
The command shouldn't fail and output:
Additional environment details
sam --version: reproduced with bothSAM CLI, version 1.121.0andSAM CLI, version 1.123.0