aws-cdk-lib: CustomResourceProvider does not allow .mjs ECMAScript modules
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the feature
When creating a CustomResourceProvider with NODEJS_20_X runtime and specifying a codeDirectory that contains an index.mjs file, the deployment fails. ("Error: cannot find codeDirectory/index.js").
### Use Case
Since it is the default now to have an index.mjs ECMAScript module when you create a node 20.x Lambda Function in the AWS console, I would expect that this is possible for CDK Custom Resources as well.
### Proposed Solution
_No response_
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.151.0
### Environment details (OS name and version, etc.)
MacOS Sonoma
Contributor guide
Research direction
Start at the CustomResourceProvider implementation and trace how codeDirectory is resolved for the NODEJS_20_X runtime. Reproduce the deployment case with a directory containing index.mjs and compare it with the current index.js expectation. Done means a CustomResourceProvider using that runtime can deploy an index.mjs module without the reported cannot-find error, with relevant tests updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, nodejs, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100