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: incorrectly maps esbuild arguments when there is whitespace in path for inject #29559

Closed
bombguy opened this issue Mar 20, 2024 · 3 comments · Fixed by #29561
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@bombguy
Copy link
Contributor

bombguy commented Mar 20, 2024

Describe the bug

When building NodejsFunctions using esbuild, it incorrectly maps the arguments to esbuild if there are paths in props.bundling.inject that has whitespace.

new NodejsFunction(scope, `some-id`, {
   bundling: {
      inject: ['/path with spaces/test.js']
   }
})

...this.props.inject ? this.props.inject.map(i => `--inject:${i}`) : [],

Expected Behavior

should be wrapped in quotes so it is not treated as multiple inputs.
-inject:"/path with spaces/test.js"

Current Behavior

there are unescaped whitespaces treating it as multiple inputs
-inject:/path with spaces/test.js

Reproduction Steps

attempt to build NodejsFunction with paths with spaces

new NodejsFunction(scope, `some-id`, {
   bundling: {
      inject: ['/path with spaces/test.js']
   }
})

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

n/a

Framework Version

No response

Node.js Version

v18.19.1

OS

mac os

Language

TypeScript

Language Version

No response

Other information

No response

@bombguy
Copy link
Contributor Author

bombguy commented Mar 20, 2024

added suggested fix: #29561

@pahud
Copy link
Contributor

pahud commented Mar 21, 2024

Thank you for the PR!

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 21, 2024
@mergify mergify bot closed this as completed in #29561 Apr 16, 2024
mergify bot pushed a commit that referenced this issue Apr 16, 2024
…reaks esbuild (#29561)

### Issue # (if applicable)
Closes #29559 .

### Reason for this change
NodejsFunction fails to build in projects with spaces in path

### Description of changes
Updated how it maps esbuild arguments from bundling props



### Description of how you validated changes
Tried building the NodejsFunction



### 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*
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.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants