Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-cdk-lib: CustomResourceProvider does not allow .mjs ECMAScript modules #31049

Open
2 tasks
bpauwels opened this issue Aug 7, 2024 · 1 comment
Open
2 tasks
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@bpauwels
Copy link

bpauwels commented Aug 7, 2024

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

@bpauwels bpauwels added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 7, 2024
@github-actions github-actions bot added the aws-cdk-lib Related to the aws-cdk-lib package label Aug 7, 2024
@ashishdhingra ashishdhingra self-assigned this Aug 7, 2024
@ashishdhingra ashishdhingra added p2 investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 7, 2024
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Aug 7, 2024

The mentioned error is perhaps thrown here. The check should be modified probably to include .mjs file if the runtime is nodejs20.x.

Creating a Lambda function in AWS console targeting Nodejs 20.x runtime uses index.mjs file as shown below:
Screenshot 2024-08-07 at 3 26 57 PM

@ashishdhingra ashishdhingra removed their assignment Aug 7, 2024
@ashishdhingra ashishdhingra added effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Aug 7, 2024
@moelasmar moelasmar added @aws-cdk/custom-resources Related to AWS CDK Custom Resources and removed aws-cdk-lib Related to the aws-cdk-lib package labels Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants