-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(asset): lambda asset bundle being moved #14369
Comments
Confirmed bug. The second time bundling runs the bundling directory already exists so bundling is correctly skipped but in this case it cannot determine if bundling resulted in a single archive file or not because the bundling directory is empty. Working on a fix. |
…archive is skipped Bundling is skipped when the bundling directory already exists on disk (cache). If it previously produced a single archive file that has been moved to the staging directory the current logic either failed to determine the correct packaging type or threw because it expected the bundling directory to include a single archive file. Fix it by "touching" the archive file in the bundling directory after it has been moved to the staging directory. Fixes aws#14369
…archive is skipped (#14372) Bundling is skipped when the bundling directory already exists on disk (cache). If it previously produced a single archive file that has been moved to the staging directory the current logic either failed to determine the correct packaging type or threw because it expected the bundling directory to include a single archive file. Fix it by "touching" the archive file in the bundling directory after it has been moved to the staging directory. Fixes #14369 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…archive is skipped (aws#14372) Bundling is skipped when the bundling directory already exists on disk (cache). If it previously produced a single archive file that has been moved to the staging directory the current logic either failed to determine the correct packaging type or threw because it expected the bundling directory to include a single archive file. Fix it by "touching" the archive file in the bundling directory after it has been moved to the staging directory. Fixes aws#14369 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I was using pnpm and esbuild and got this error. Installing pnpm globally resolved me the issue |
@jogold I hit a new bug very similar to this one. The touching of the file leads to errors of the hashType is OUTPUT. The second build will skip bundling but create a new hash for the asset because of the now empty file and then the asset will be moved again but empty. My suggestion is to remove the temporary bundleDir in that case instead of touching the file. Any objections? I will create a new PR for this just wanted to note it down somewhere. |
Bunding my Go Lambda function with Docker and having the output of the bundle a zip works the first time, but subsequent bundles fail. I've had a dig through the source code and I believe it's because the bundled zip file is being moved after it is created (see here).
Below is the code being used to bundle and create the Lambda function. One thing to note, the
ouputType
property needs to be set tocdk.BundingOutput.ARCHIVED
because Windows 10 will strip the execute permission off the binary if it isn't zipped (see here).Reproduction Steps
I've attached a simple CDK project that demonstrates this issue. Simply unzip the attached project and run either
cdk synth
orcdk deploy
twice. The first time should succeed and the second time should fail with the following error message.Error: Bundling output directory is expected to include only a single .zip or .jar file when `output` is set to `ARCHIVED`
What did you expect to happen?
The Lambda source code to be successfully bundled both times.
What actually happened?
The Lambda source code failed to be bundled the second time. Returning the following error message
Error: Bundling output directory is expected to include only a single .zip or .jar file when `output` is set to `ARCHIVED`
Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: