Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: KeyError caused by not loading assets #3496

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions samcli/lib/iac/cdk/cloud_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,13 @@ def find_nested_stack_by_cdk_path(self, cdk_path: str) -> Optional["CloudAssembl
return None

def _extract_assets(self) -> None:
for item in self.metadata.get(f"/{self.stack_name}", {}):
assert "type" in item
if item["type"] == ASSET_TYPE:
self._assets_by_id[item["data"]["id"]] = item["data"]
self._assets_by_path[item["data"]["path"]] = item["data"]
for key in self.metadata.keys():
items = self.metadata.get(key)
for item in items:
assert "type" in item
if item["type"] == ASSET_TYPE:
self._assets_by_id[item["data"]["id"]] = item["data"]
self._assets_by_path[item["data"]["path"]] = item["data"]

def _update_resources_paths(self) -> None:
update_relative_paths(self.template, self.source_directory, self.directory, skip_assets=True)
Expand Down