Open mhart opened 4 years ago
@jogold let's move asset zipping from the CLI to the app and combine the ability to allow users to output a .zip file from a bundling operation in order to allow them to fully customize (see this).
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
This is still a problem, as far as I can tell. I'm trying to deploy a single yarn workspace with its node_modules. Yarn gives workspaces a symlink to themselves (i.e. packages/foo/node_modules/
has a symlink foo
pointing up a directory) so that they can resolve themselves by name. In this case the upload fails as it has infinitely recursed, resulting in ENAMETOOLONG.
I guess solutions are to manually exclude the offending symlink if you don't need it in the options, or to create the zip file yourself.
I am running into this issue as well. The CDK bundle contains symlinks but the zip file uploaded to lambda contains no symlinks and appears to have followed the symlinks when zipping, regardless of SymlinkFollowMode
.
This breaks trying to bundle dependencies for Nextjs in standalone output mode when using a pnpm monorepo.
I am on cdk v2.85.0 and it seems like the SymlinkFollowMode.NEVER
does still not work.
I can confirm that zipping the contents of my folder is a workaround.
to keep this alive: this issue can still be observed in cdk v2.141.0
It seems that while
FollowMode
is respected while copying assets tocdk.out
, it's not respected when publishing said assets to S3.A cursory glance at the packaging code shows why this is the case: https://github.com/aws/aws-cdk/blob/dac9bb312f5b0a9c83d929c862e30b49f3b8654a/packages/cdk-assets/lib/private/archive.ts#L8-L16
Both
nodir
andfollow
are hardcoded here and so usingFollowMode.NEVER
has no effect: symlinks are always followed when uploading to S3.Reproduction Steps
Create a
layer
directory that contains a file and a relative symlink to that file.Create a CDK stack containing:
Observe that in the asset directory in
cdk.out
, the symlink is preserved as is – it's a relative symlink that points to the file as it was when you created it.Observe that in the uploaded asset however, the symlink has been followed (ie, the file is duplicated in the layer, there is no symlink anymore). You can either do this by using the layer in a Lambda, or by simply downloading the zipfile asset that was published to S3 and listing its contents.
So there appears to be no way to upload layers (or functions) and preserve symlinks – unless you manually zip them yourselves. Which means
FollowMode
has no effect.Environment
This is :bug: Bug Report