sam-beta-cdk raises an error without any additional context
See original GitHub issueDescription:
sam-beta-cdk
raises an error when trying to start-api
or invoke
locally. I’m hoping I don’t have to post the entire CDK stack template here because it is large.
Steps to reproduce:
- download and install:
brew install aws-sam-cli-beta-cdk
(osx) - run
sam-beta-cdk local start-api
Observed result:
› sam-beta-cdk local start-api --debug
2021-06-17 16:35:40,390 | Determining project type...
2021-06-17 16:35:40,390 | The project is a CDK project.
2021-06-17 16:35:40,434 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2021-06-17 16:35:40,439 | CDK Toolkit found at ./node_modules/aws-cdk/bin/cdk
2021-06-17 16:35:40,439 | Synthesizing CDK App
2021-06-17 16:35:40,439 | command: ['./node_modules/aws-cdk/bin/cdk', 'synth', '--no-staging', '-o', '.aws-sam/.cdk-out']
2021-06-17 16:35:51,424 | Cloud assembly synthed at .aws-sam/.cdk-out
2021-06-17 16:35:51,424 | _validate_cloud_assembly: .aws-sam/.cdk-out
2021-06-17 16:35:51,431 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'c87edbda-20b4-4869-9a03-c866c6fc96f7', 'installationId': '4d5c1751-ca4e-4c25-8c05-f33973bc5430', 'sessionId': '37acf4f4-8fd2-4b40-a68e-67100f4fa95a', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.10', 'samcliVersion': '1.22.0.dev202104291816', 'metricSpecificAttributes': {'projectType': 'CDK'}, 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam-beta-cdk local start-api', 'duration': 10994, 'exitReason': 'KeyError', 'exitCode': 255}}]}
2021-06-17 16:35:51,670 | Telemetry response: 200
Traceback (most recent call last):
File "/usr/local/bin/sam-beta-cdk", line 8, in <module>
sys.exit(cli())
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 174, in wrapped
raise exception # pylint: disable=raising-bad-type
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 141, in wrapped
return_value = func(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/iac/utils/helpers.py", line 30, in wrapper
project = iac_plugin.get_project(lookup_paths)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/iac/cdk/plugin.py", line 116, in get_project
project = self._get_project_from_cloud_assembly(cloud_assembly_dir)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/iac/cdk/plugin.py", line 207, in _get_project_from_cloud_assembly
stacks: List[Stack] = [self._build_stack(cloud_assembly, ca_stack) for ca_stack in cloud_assembly.stacks]
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/iac/cdk/plugin.py", line 207, in <listcomp>
stacks: List[Stack] = [self._build_stack(cloud_assembly, ca_stack) for ca_stack in cloud_assembly.stacks]
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/iac/cdk/plugin.py", line 222, in _build_stack
self._build_resources_section(assets, ca_stack, cloud_assembly, section, section_dict)
File "/usr/local/Cellar/aws-sam-cli-beta-cdk/202104291816/libexec/lib/python3.8/site-packages/samcli/lib/iac/cdk/plugin.py", line 280, in _build_resources_section
asset = assets[asset_path]
KeyError: '/Users/jleroux/w/stedi/go/src/github.com/stedi/LedgerService/.aws-sam/.cdk-out/asset.92b31737b3dd47bb510f50634eaec000886b4a4c4988aa68e481619a4c928163'
Expected result:
It starts the API
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: OSX
sam --version
: `SAM CLI, version 1.22.0.dev202104291816``- AWS region:
us-east-1
Add --debug flag to command you are running
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Python "raise from" usage - Stack Overflow
When raising from a exception handler where you don't want to show the context (don't want a during handling another exception happened message) ......
Read more >Built-in Exceptions — Python 3.11.1 documentation
This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full”...
Read more >Exceptions - Django REST framework
REST framework's views handle various exceptions, and deal with returning appropriate error responses. The handled exceptions are: Subclasses of APIException ...
Read more >Best Practices for exceptions - .NET - Microsoft Learn
A well-designed app handles exceptions and errors to prevent app ... shows how to read to the end of a file without triggering...
Read more >RAISE EXCEPTION - ABAP Keyword Documentation
... processing can only be resumed again after the statement RAISE EXCEPTION (and without closing the context) if the addition RESUMABLE is specified....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not sure why, but this workaround at least allows you to continue using
sam-beta-cdk
:SAM CLI’s CDK support went into GA yesterday with some changes. Now sam-cli won’t run cdk but user will have to run and provide the path. This should solve this problem. Please let us know if you have more questions. Please find more details here