Reputation: 139
I am trying to deploy some code using codepipline and I get the error below. My CDK code is very simple and not using lambda function. However, this may be the result of some default settings.
Resource handler returned message: "Error occurred while GetObject.
S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist.
(Service: Lambda, Status Code: 400, Request ID: 3160ff16-1e4a-4a38-b609-34820a1d9a8f)"
(RequestToken: a8b5eecf-8c1d-d90f-e18f-390a05734944, HandlerErrorCode: InvalidRequest)
The error is also reported in the aws-cdk Github page but the issue was closed without a comprehensive conclusion: https://github.com/aws/aws-cdk/issues/22198
Additional information: I've also tried to deploy via 'cdk deploy' which copies the asset(s) to the S3 bucket but it does not resolve this issue.
Can anyone share any hints to resolve this issue?
My aws-cdk-lib
version is 2.40.0
.
Upvotes: 0
Views: 901
Reputation: 1
As implied by gshpychka, an outdated CodePipeline can cause this.
CDK uploads your code (an "asset") to the S3 bucket cdk-hnb659fds-assets-ACCOUNT-REGION. The name of the asset is "HASH.zip" (called S3Key).
If something causes the hash to change, the pipeline's FileAssetXX action created by CDK will use the old hash unless you redeploy the pipeline's stack.
The stack you are deploying will be built from latest source code and get the new hash, which it will then be unable to find.
Upvotes: 0