Skip to content

aws-lambda-nodejs: incorrectly maps esbuild arguments when there is whitespace in path for inject #29559

@bombguy

Description

@bombguy

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions