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

core: Differing CDK assets not deploy if already deployed. #30962

Open
scottschreckengaust opened this issue Jul 26, 2024 · 7 comments
Open

core: Differing CDK assets not deploy if already deployed. #30962

scottschreckengaust opened this issue Jul 26, 2024 · 7 comments
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@scottschreckengaust
Copy link

scottschreckengaust commented Jul 26, 2024

Describe the bug

An updated CDK asset does not deploy if already deployed.

Expected Behavior

% cdk deploy
% ls ./cdk.out/asset.bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21/python/orjson/orjson.*.so
./cdk.out/asset.bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21/python/orjson/orjson.cpython-312-aarch64-linux-gnu.so
% cdk destroy
% rm -r -f ./cdk.out
% DOCKER_DEFAULT_PLATFORM=linux/amd64 cdk deploy
% ls ./cdk.out/asset.bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21/python/orjson/orjson.*.so
./cdk.out/asset.bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21/python/orjson/orjson.cpython-312-aarch64-linux-gnu.so

orjson.cpython-312-x86_64-linux-gnu.so should be the updated resource, but is the prior version orjson.cpython-312-aarch64-linux-gnu.so is in the Lambda Layer.

Current Behavior

The example asset, Lambda Layer, is the original deployment, not the updated version.

Reproduction Steps

TBD

Possible Solution

  1. Destroy the stack
  2. Delete the asset from S3 if there has been a prior deployment
  3. Deploy with DOCKER_DEFAULT_PLATFORM=linxu/amd64 cdk deploy

Additional Information/Context

No response

CDK CLI Version

2.150.0

Framework Version

No response

Node.js Version

20.16.0

OS

macOS 14.5

Language

Python

Language Version

Python 3.12.3

Other information

No response

@scottschreckengaust scottschreckengaust added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 26, 2024
@github-actions github-actions bot added the @aws-cdk/assets Related to the @aws-cdk/assets package label Jul 26, 2024
@ashishdhingra
Copy link
Contributor

@scottschreckengaust Good afternoon. Thanks for opening the issue. Please share the minimal reproduction code along with steps to troubleshoot the issue.

Thanks,
Ashish

@ashishdhingra ashishdhingra added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 26, 2024
@scottschreckengaust
Copy link
Author

@scottschreckengaust Good afternoon. Thanks for opening the issue. Please share the minimal reproduction code along with steps to troubleshoot the issue.

Thanks, Ashish

I was going to attempt an SSCCE but the below steps replicate the issue:

  1. Clone and follow the installation instructions on an Apple silicon macOS (M1, M2, and M3):
git clone https://github.com/aws-samples/generative-ai-cdk-constructs-samples
cd generative-ai-cdk-constructs-samples/tree/main/samples/contract-compliance-analysis/back-end
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cdk deploy --require-approval=never
ls ./cdk.out/asset.bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21/python/orjson/orjson.*.so
  1. Destroy the stack
cdk destroy --force
  1. Attempt to deploy x86_64 version (assume previous S3 object is reused):
DOCKER_DEFAULT_PLATFORM=linxu/amd64 cdk deploy --require-approval=never
ls ./cdk.out/asset.bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21/python/orjson/orjson.*.so
  1. Download the lambda layer, "LangChainDependenciesLayerLangchainLayer*.zip", and review that the pacakges are aarch64 and not x86_64

  2. Destroy the stack again and ALSO delete the S3 cdk object in the bootstrapped bucket

cdk destroy --force
aws s3 rm s3://cdk-hnb659fds-assets-713520743023-us-east-1/bcfc35ab235043b602bca1e99df11b1dcce6d0bf563f013c7c50797bb8644a21.zip
  1. Repeat x86_64 deploy successfully above
DOCKER_DEFAULT_PLATFORM=linxu/amd64 cdk deploy --require-approval=never
  1. Confirm by inspecting the lambda layer to match x86_64 packages.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 27, 2024
@ashishdhingra ashishdhingra self-assigned this Jul 29, 2024
@ashishdhingra ashishdhingra added investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-reproduction This issue needs reproduction. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jul 29, 2024
@ashishdhingra
Copy link
Contributor

Reproducible. Few observations below on 2nd deployment:

  • If cdk.out folder is not deleted, it doesn't update the library orjson with new x86_x64 version of .so file.
  • If cdk.out folder is deleted before deployment, it downloads the update the library orjson with new x86_x64 version of .so file. But if S3 asset is not manually deleted, it doesn't update the asset and due to this the Lambda layer has old aarch64 version of the library.
  • If cdk.out folder and S3 asset is deleted before deployment, we could see the logs being emitted where it us uploading assets. Lambda layer latest version would now have correct orjson with new x86_x64 version of .so file.

@ashishdhingra ashishdhingra added effort/medium Medium work item – several days of effort and removed needs-reproduction This issue needs reproduction. labels Aug 1, 2024
@ashishdhingra ashishdhingra removed their assignment Aug 1, 2024
@ashishdhingra ashishdhingra changed the title (module name): Differing CDK assets not core: Differing CDK assets not deploy if already deployed. Aug 1, 2024
@ashishdhingra ashishdhingra added p1 and removed p2 labels Aug 1, 2024
@jk2l
Copy link

jk2l commented Aug 7, 2024

part of your manual involvement for fixing the issue seem to similar to my raised issue #31051

@scottschreckengaust
Copy link
Author

bumping so doesn't go stale

@scottschreckengaust
Copy link
Author

bump

@scottschreckengaust
Copy link
Author

Comment so doesn't go stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants