aws / aws/aws-cdk

(aws-lambda-nodejs): Allow `followSymlink` override in bundling

Open
#21,213 1 comment 1 reaction 0 assignees View on GitHub
@aws-cdk/aws-lambda-nodejs effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
71

Description

### Describe the feature

Currently, `bundling` does not allow setting the `followSymlink` mode. I would like to pass that down to the `Code.fromAsset` call that bundling ultimately makes.

### Use Case

node_modules installed in a layer do not work out of the box with ES Modules. I would like to use the workaround shown [here](https://github.com/vibe/aws-esm-modules-layer-support).

### Proposed Solution

Pass down `followSymlinks` in the same way that `assetHash` is.

### Other Information

This doesn't currently work because the default `followSymlink` mode tries to dereference the link I'm adding in an `afterBundling` command hook.

### Acknowledgements

- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.32.1

### Environment details (OS name and version, etc.)

macOS Monterey

Contributor guide

Open the contributing guide

Research direction

Start at the aws-lambda-nodejs bundling entry point and trace the Code.fromAsset call, comparing how assetHash is passed through. Add the followSymlinks override consistently and verify that bundling preserves the requested symlink behavior, including the afterBundling case described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
build-system, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.