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): esbuild define parameters are incorrectly encoded #14065

Merged
merged 6 commits into from
Apr 12, 2021

Conversation

skyrpex
Copy link
Contributor

@skyrpex skyrpex commented Apr 8, 2021

Fixes #13842

@gitpod-io
Copy link

gitpod-io bot commented Apr 8, 2021

@skyrpex
Copy link
Contributor Author

skyrpex commented Apr 8, 2021

There's still invalid edge cases.

@skyrpex skyrpex reopened this Apr 9, 2021
@gitpod-io
Copy link

gitpod-io bot commented Apr 9, 2021

@skyrpex skyrpex force-pushed the skyrpex/fix-esbuild-define-parameters branch from fb537d9 to 38bfb8c Compare April 9, 2021 08:29
@skyrpex
Copy link
Contributor Author

skyrpex commented Apr 9, 2021

Alright, in order to fix the esbuild define instructions for the CLI, I had to JSON.stringify all the values. Now they work as expected.

Added a snapshot test that calls the esbuild CLI to ensure that this doesn't break again.

@skyrpex skyrpex marked this pull request as ready for review April 9, 2021 08:56
Copy link
Contributor

@jogold jogold left a comment

Choose a reason for hiding this comment

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

Thanks @skyrpex!

Some minor comments.

packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts Outdated Show resolved Hide resolved
'--log-level=silent --keep-names --tsconfig=/asset-input/lib/custom-tsconfig.ts',
'--metafile=/asset-output/index.meta.json --banner=\'/* comments */\' --footer=\'/* comments */\'',
].join(' '),
],
}),
});

// Make sure that the define instructions are working as expected with the esbuild CLI
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we really need to run esbuild here in the test? Isn't it enough to ensure that the right command line args are passed?

Copy link
Contributor Author

@skyrpex skyrpex Apr 9, 2021

Choose a reason for hiding this comment

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

Well, I got it right this time and reverse-engineered the define parameters' expectation (it's a hell plenty of escape slashes). It should be stable now and the test is not exactly necessary, but it's proof that it works now.

Let me know if you want me to remove it 👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

I like that this is doing an end to end test

Co-authored-by: Jonathan Goldwasser <jogold@users.noreply.github.com>
@mergify
Copy link
Contributor

mergify bot commented Apr 12, 2021

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).

@eladb eladb changed the title fix(aws-lambda-nodejs): esbuild define parameters are incorrectly encoded fix(lambda-nodejs): esbuild define parameters are incorrectly encoded Apr 12, 2021
@eladb eladb added the pr/do-not-merge This PR should not be merged at this time. label Apr 12, 2021
@eladb
Copy link
Contributor

eladb commented Apr 12, 2021

@jogold waiting for your approval and I'll remove the do-not-merge label

@eladb eladb removed the pr/do-not-merge This PR should not be merged at this time. label Apr 12, 2021
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 5611eff
  • 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 Apr 12, 2021

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 5378a77 into aws:master Apr 12, 2021
@skyrpex skyrpex deleted the skyrpex/fix-esbuild-define-parameters branch April 12, 2021 06:58
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-lambda-nodejs): "define" bundling option is not escaped
4 participants