I have written a simple hello world lambda function to deploy but after the command cdk deploy it is giving this error. Can someone please guide about this?
I have written a simple hello world lambda function to deploy but after the command cdk deploy it is giving this error. Can someone please guide about this?
This issue might be caused by https://github.com/aws/aws-cdk/issues/12536. You should try:
cdk.outcdk-hnb659fds-assets-<ACCOUNT NUMBER>-<REGION>)CDK doesn't reupload the asset unless it changed. That's why deleting it and maybe forcing a change after upgrading node.js is required.
If all else fails, try the script I wrote that downloads the asset, fixes it by rezipping, and uploads it again. It's expecting to run in the root of your project as it looks for cdk.out.
#!/bin/bash
set -ex
ASSEMBLY_DIRECTORY=`jq -r '.artifacts[] | select(.type == "cdk:cloud-assembly") | .properties.directoryName' cdk.out/manifest.json`
ASSET_MANIFESTS=`jq -r '.artifacts[] | select(.type == "cdk:asset-manifest") | .properties.file' cdk.out/$ASSEMBLY_DIRECTORY/manifest.json`
cd cdk.out/$ASSEMBLY_DIRECTORY
ASSETS=`jq -r '.files[].destinations[] | "s3://" + .bucketName + "/" + .objectKey' $ASSET_MANIFESTS | grep zip`
TMP=`mktemp -d`
cd $TMP
for ASSET in $ASSETS
do
if aws s3 ls $ASSET; then
aws s3 cp $ASSET pkg.zip
mkdir s
cd s
if ! unzip ../pkg.zip; then echo bad zip; fi
rm ../pkg.zip
zip -r ../pkg.zip * .gitempty
aws s3 cp ../pkg.zip $ASSET
cd ..
rm -rf s
fi
done
rm -rf $TMP
You can confirm you're having the same issue I was having by downloading the asset zip file. Try extracting it with unzip. If it complains about the checksum or CRC, you had the same issue.