-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(aws-lambda-nodejs): Default entry finding when Node returns paths starting with file:// #21802
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
fix(aws-lambda-nodejs): Default entry finding when Node returns paths starting with file:// #21802
Conversation
|
@corymhall Please advice if I should change |
I think we can add a test in |
…e paths starting with file:// prefix
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see an integration test for this. It's not part of our PRLinter just yet (change coming soon) but we are now requiring integ tests on fixes.
|
An integration test would require the test tooling to compile the test case project to ESM and then synthesize that. I believe that would require a separate package.json, tsconfig.json, jest config, cdk.json that executes ts-node in esm mode, and hooking that into the way the tests run. I'm not familiar enough with the aws-cdk development tooling to do all of that, and I think that shouldn't be in the scope of this fix. I have provided all the needed files at https://github.com/okko/aws-cdk-esm-file-urls-reproduce for reference. At the moment this blocks us from using NodejsFunction with a project compiling to ESM. |
Pull request has been modified.
We should update the |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting this back into changes requested in regard to updating the test.
|
@okko any updates? Tricks with 'entry: new URL(import.meta.url.replace(/(.*).(.+)/, |
|
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
Pull request has been modified.
aws-cdk-automation
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
|
The pull request linter fails with the following errors: PRs must pass status checks before we can provide a meaningful review. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
This PR has been deemed to be abandoned, and will be closed. Please create a new PR for these changes if you think this decision has been made in error. |
### Issue # (if applicable) Closes #21630. ### Reason for this change In the ESM module system, callsites returns filenames prefixed with 'file://'. This is not compatible with the NodeJS file utility functions such as fs.existsSync(). ### Description of changes Remove 'file://' prefix. ### Describe any new or updated permissions being added No new IAM permissions are added. ### Description of how you validated changes Unit tests. Integration test cannot be added as the integration test system uses CommonJS, it will be impossible to replicate the error which only happens under an ESM system. ### Credits This is mostly inspired by @okko for [his PR](#21802). He found the root cause and fix for this issue, but it didn't get merged due to a lack of integration tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes #21630.
Stack filenames contain
file://prefix in ES module files. This removes the prefix for Node compatibility.All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integto deploy the infrastructure and generate the snapshot (i.e.yarn integwithout--dry-run)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license