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

fix(lambda-nodejs): cannot bundle when entry file is named index.ts #9724

Merged
merged 3 commits into from Aug 17, 2020

Conversation

jogold
Copy link
Contributor

@jogold jogold commented Aug 14, 2020

Do not rename the dist file if it's already named index.js.

Fixes #9709


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Do not rename the dist file if it's already named `index.js`.

Fixes aws#9709
@@ -168,7 +168,7 @@ export class Bundling {
// Always rename dist file to index.js because Lambda doesn't support filenames
// with multiple dots and we can end up with multiple dots when using automatic
// entry lookup
`mv ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/${distFile} ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/index.js`,
distFile !== 'index.js' ? `mv ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/${distFile} ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/index.js` : '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be less error prone to just have parcel output as index.js? parcel-bundler/parcel#884

Doesn't look like using the entry name has any value and we could remove the parsing on line 155.

Suggested change
distFile !== 'index.js' ? `mv ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/${distFile} ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/index.js` : '',
'--out-file index.js'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately --out-file is a Parcel v1 option, not v2. In v2 you need to configure it in the package.json but I want to avoid this to allow #9632

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Parcel seems like a pile.

eladb
eladb previously approved these changes Aug 17, 2020
@mergify mergify bot dismissed eladb’s stale review August 17, 2020 08:57

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Aug 17, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 8720697
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Aug 17, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit bb90fbe into aws:master Aug 17, 2020
@jogold jogold deleted the lambda-nodejs-index-fail branch August 17, 2020 10:38
plumdog added a commit to isotoma/ses-smtp-credentials-cdk that referenced this pull request Feb 9, 2021
plumdog added a commit to isotoma/ses-smtp-credentials-cdk that referenced this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[@aws-cdk/aws-lambda-nodejs] Bundle fails on 1.58 due to incorrect path.
4 participants