Bug: sam local start-api - AttributeError
Description:
Steps to reproduce:
Observed result:
Expected result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS:
sam --version:- AWS region:
# Paste the output of `sam --info` here
Add --debug flag to command you are running
{hawcc}:/workspace/home-inv-app/back-end$ sam local start-api
No current session found, using default AWS::AccountId
Initializing the lambda functions containers.
Local image is up-to-date
Using local image: public.ecr.aws/lambda/python:3.9-rapid-x86_64.
Mounting /workspace/home-inv-app/back-end as /var/task:ro,delegated, inside runtime container
Containers Initialization is done.
Error: 'NoneType' object has no attribute 'items' Traceback: File "click/core.py", line 1078, in main File "click/core.py", line 1688, in invoke File "click/core.py", line 1688, in invoke File "click/core.py", line 1434, in invoke File "click/core.py", line 783, in invoke File "samcli/cli/cli_config_file.py", line 347, in wrapper File "click/decorators.py", line 92, in new_func File "click/core.py", line 783, in invoke File "samcli/lib/telemetry/metric.py", line 185, in wrapped File "samcli/lib/telemetry/metric.py", line 150, in wrapped File "samcli/lib/utils/version_checker.py", line 43, in wrapped File "samcli/cli/main.py", line 95, in wrapper File "samcli/commands/local/start_api/cli.py", line 150, in cli File "samcli/commands/local/start_api/cli.py", line 258, in do_cli File "samcli/commands/local/lib/local_api_service.py", line 42, in init File "samcli/lib/providers/api_provider.py", line 40, in init File "samcli/lib/providers/api_provider.py", line 67, in _extract_api File "samcli/lib/providers/sam_api_provider.py", line 78, in extract_resources File "samcli/lib/providers/sam_api_provider.py", line 436, in _extract_routes_from_function File "samcli/lib/providers/sam_api_provider.py", line 470, in extract_routes_from_events
An unexpected error was encountered while executing "sam local start-api". Search for an existing issue: https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20local%20start-api%20-%20AttributeError Or create a bug report: https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20local%20start-api%20-%20AttributeError
Would you be able to share the SAM template that you're using to run the command? I've seen in the past when there's a template with some malformed resources, or wrong indentation in the YAML file.
There's was also a transient issue with the same error message a few years back (on sam deploy instead of sam local start-api : #6014), that didn't have a way to be reproduced consistently. If you can share your template (please redact and/or change any sensitive information in it), maybe we can see if it's an issue that we can reproduce and troubleshoot.
@Khushmohitkar can you provide us your sample template so that we can try to reproduce the issue?
@Khushmohitkar Looks like this might be a duplicate of:
- #7968 - Bug: sam build - AttributeError
- #1396 - AttributeError in intrinsics_symbol_table.py
- #8166 - Bug: Lambda functions containers initialization failed because of [Errno 17] File exists
Can you check if those cover your case? If not, explain what's different.