-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
aws-s3-assets: Asset publish fails on files with no extension if outputType is BundlingOutput.SINGLE_FILE #30471
Comments
Yes I can reproduce this. It doesn't have to be a golang app, just generate a file under export class AssetTestStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const asset = new s3assets.Asset(this, 'asset', {
path: path.join(__dirname, '../assets/main'),
bundling: {
image: DockerImage.fromRegistry('golang:1.21'),
entrypoint: ["bash", "-c"],
// command: ["echo 123 > /asset-output/main"], // this won't work
command: ["echo 123 > /asset-output/main.bin"], // this works
outputType: BundlingOutput.SINGLE_FILE,
},
});
new CfnOutput(this, 'AssetHash', { value: asset.assetHash });
}
} Error message
|
It seems to be caused by a mismatch between the contents of AssetManifest and the path of the file to be uploaded. |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
I'm using S3 Assets to build an executable which is downloaded on my AL2023 EC2 instances and run at startup. UNIX executables commonly have no file extension, so I named my output file
main
. Since there is only 1 output file, I used the SINGLE_FILE outputType. After bundling completes but before the asset is uploaded,cdk deploy
will fail with the exceptionEISDIR: illegal operation on a directory, read
.Expected Behavior
The bundled asset should have uploaded to S3 successfully. I am able to upload the asset from the cdk.out temporary directory to S3 via the console without issue.
Current Behavior
The following is the cdk deploy output:
Interestingly, the key of the asset that failed is incorrect.
2ea762ee87d2dc20644f7ffe229b3f751c9831030044b4761eaef6d4688761d3
is the CloudFormation template JSON which uploaded to S3 successfully (as per the Published message).9282ebaea97fbf485dc50bbffd97ef346bb60994b53468da7becca020a3dbbb0
is the asset which bundled successfully but failed to upload.Reproduction Steps
The following is a stack I created to isolate the issue. In this case, the asset is a Go module located at
/assets/main
but any code that compiles to a single file should produce the same result.Possible Solution
Changing the name of the output file to
main.bin
fixed the issue, but it took me a while to figure out what was causing this error since I had multiple S3 assets in the stack where I originally encountered this issue. I would assume the error comes down to the CDK incorrectly parsing a file with no extension as a directory.Additional Information/Context
No response
CDK CLI Version
2.144.0 (build 5fb15bc)
Framework Version
No response
Node.js Version
Node.js v18.17.1
OS
MacOS 12.6
Language
TypeScript
Language Version
TypeScript (5.4.5)
Other information
No response
The text was updated successfully, but these errors were encountered: