-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
aws_lambda_python_alpha: Using PIP_INDEX_URL and Codeartifact cause Docker to rebuild lambda every synth #27331
Comments
I believe this is intentional due to how CodeArtifact handles these resources. |
@indrora could you explain a bit more why this is intentional? It doesn't seem right that despite having the exact same code, the lambda gets rebuilt/redeployed. The only thing that changes here is the CodeArtifact auth token, which doesn't seem like something that should be included in the lambda hash since it's temporary by definition! |
Having same problem. |
I looked into this a bit more, and explored the fact that it's possible to pass in a custom assetHash instead of relying on the hash computed by the CDK code. Unfortunately, that won't work, as the bundling information (which includes the I'd be willing to take on the work here to fix this issue, but could use some guidance on the design first.
|
I think the best option to go is the ability to provide custom repos urls as a bundler option. So the logic applied to |
… PIP urls, causing an unnecessary rebuild (#27903) Update the bundler hash logic to ignore the secret token that is included in the URL when fetching packages from Code Artifact. This token changes constantly, and prevents the results of a previous build from being reused, along with causing lambdas to be unnecessarily redeployed anytime the CDK is built, even if no code is changed. This implementation strips the token from the hash, but does not change anything else about the hash. Open question Currently this logic will error if an invalid URL string is passed for PIP_INDEX_URL or PIP_EXTRA_INDEX_URL. The build would fail later anyway when those URLs are being used, but I'm happy to try/catch this logic block to be more robust if that is preferred. Closes #27331. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
… PIP urls, causing an unnecessary rebuild (aws#27903) Update the bundler hash logic to ignore the secret token that is included in the URL when fetching packages from Code Artifact. This token changes constantly, and prevents the results of a previous build from being reused, along with causing lambdas to be unnecessarily redeployed anytime the CDK is built, even if no code is changed. This implementation strips the token from the hash, but does not change anything else about the hash. Open question Currently this logic will error if an invalid URL string is passed for PIP_INDEX_URL or PIP_EXTRA_INDEX_URL. The build would fail later anyway when those URLs are being used, but I'm happy to try/catch this logic block to be more robust if that is preferred. Closes aws#27331. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
When following the instructions for using CodeArtifact, the lambda artifact is rebuilt anytime the CodeArtifact token changes, despite the actual code not changing at all.
Expected Behavior
The lambda shouldn't be rebuilt unless the actual code changes.
Current Behavior
The lambda is rebuilt with a new hash, which causes an unnecessary redeploy. This slows down the synth and deploy steps, and causes cold starts for all lambdas.
Reproduction Steps
Define any lambda function using the Custom Bundling with Code Artifact instructions. Observe that the lambda is rebuilt on each synth, even with no code changes.
Possible Solution
The Token included in the CodeArtifact URL should be ignored when computing the hash that determines if the lambda is rebuilt. Alternately, provide an option to ignore the PIP_INDEX_URL entirely.
Additional Information/Context
No response
CDK CLI Version
2.95.1
Framework Version
No response
Node.js Version
v20.6.1
OS
OSX 12.2
Language
Python
Language Version
Python 3.9.16
Other information
No response
The text was updated successfully, but these errors were encountered: