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-lambda-nodejs: Paths with Spaces Break ESBuild #13311

Closed
GEMISIS opened this issue Feb 28, 2021 · 2 comments · Fixed by #13312
Closed

aws-lambda-nodejs: Paths with Spaces Break ESBuild #13311

GEMISIS opened this issue Feb 28, 2021 · 2 comments · Fixed by #13312
Assignees
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@GEMISIS
Copy link
Contributor

GEMISIS commented Feb 28, 2021

When creating a NodeJS lambda function using the aws-lambda-nodejs module, if a path has spaces in it on Windows, then esbuild will fail to properly bundle the package.

Reproduction Steps

  1. Create a new with code like this:
    const userAuthLambda = new NodejsFunction(this, 'user-auth-lambda', {
      runtime: Runtime.NODEJS_14_X,
      entry: path.join(__dirname, '../functions/UserAuth.ts'),
      handler: 'handler'
    });
  1. Run npm run build
  2. Run cdk synth
  3. Observe error

What did you expect to happen?

cdk synth should create the CloudFormation template as expected.

What actually happened?

Receiving the error error: Must use "outdir" when there are multiple input files

Environment

  • CDK CLI Version : 1.91.0
  • Framework Version: 1.91.0
  • **Node.js Version: **v12.19.0
  • OS : Windows
  • Language (Version): TypeScript (3.8.3)

Other

Issue #13210 previously reported this and Pull Request 13268 attempted to fix it. However, after testing this out locally on my Windows machine, this does not seem to have actually resolved it. I have a fix incoming for this now and will make sure to reference this issue.


This is 🐛 Bug Report

@GEMISIS GEMISIS added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 28, 2021
@GEMISIS GEMISIS changed the title aws-lambda-nodejs: short issue description aws-lambda-nodejs: Paths with Spaces Break ESBuild Feb 28, 2021
@mergify mergify bot closed this as completed in #13312 Feb 28, 2021
mergify bot pushed a commit that referenced this issue Feb 28, 2021
Problem: Paths with spaces break ESBuild on Windows.
Solution: Add double quotes around the input paths for the ESBuild command.
Testing: Updated unit tests and confirmed in my own package this fix works.

Closes #13311

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@MichaelVidStep
Copy link

Hi there,

I'm still getting this error. What is the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants