Closed adamscybot closed 1 week ago
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
Description
The issue is that when specifying
source_files
such that some symlinks are encountered, the resulting zip archive does not preserve the symlinks (counter to some misinformation online, AWS Lambda itself does support this). Instead, the destination of any links is copied as a file/dir (it doesn't work on either).This is a problem in my case since I use
pnpm
who's (much superior) install strategy is such that thenode_modules
structure relies on symlinks. As a result, the resulting zip created by this module is huge because of the duplication.pnpm
uses hard links but I've also verified the same issue occurs on soft links.This module does not use the archive provider, which gave me hope that it would work since that has its own issue in the same area. But it's not to be confused with it.
The only mention of symlinks I could find on this repo was on this issue , where a contributor mentioned that one of the reasons this module has its own impl is symlink support. So, I think it's not working as expected.
According to this StackOverflow post, you have to do a bit extra to support this with Pythons
zipfile
.Versions
Module version [Required]: 7.7.0
Terraform version: 1.9.2
Provider version(s):
Also my Python is 3.10.12.
Reproduction Code [Required]
Manually create a dummy src dir
Create resources
Get the zip file and check it
Then note down the zip filename it created in the
builds
folder. Then unzip it.Observe that this output shows no links and the links are copies of their original destination.
I have also ensured its not something weird with my
unzip
by proving a point by using it on something I manually usedzip -y
with. That worked fine and the zip was 4x smaller.Expected behavior
I would expect the unzipped archive to maintain the symlinks.
Actual behavior
Any symlinks are copied as files/dirs, causing duplication