Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(aws-lambda-nodejs): Windows bundling issue with chain command #30543

Open
smivanhamrah opened this issue Jun 13, 2024 · 1 comment
Open

(aws-lambda-nodejs): Windows bundling issue with chain command #30543

smivanhamrah opened this issue Jun 13, 2024 · 1 comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@smivanhamrah
Copy link

smivanhamrah commented Jun 13, 2024

Describe the bug

We are not able to bundle the lambdas using aws-cdk. we get Illegal character '"' in input file. error.
Windows CMD doesn't not support "&&" as chain command, and instead we should use ";"

// packages/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.ts

function chain(commands: string[]): string {
  return commands.filter(c => !!c).join(' && ');
}

we need to change this function to

// packages/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.ts
function chain(commands: string[]): string {
  const sign = this.osPlatform === 'win32' ? ';' : '&&';
  return commands.filter(c => !!c).join(` ${sign} `);
}

Expected Behavior

yarn cdk deploy .. should be able to bundle the lambdas on windows

Current Behavior

yarn cdk deploy .. raises Illegal character '"' in input file. error on windows.

Reproduction Steps

Try to run following sample on windows

const stack = cdk.Stack()
new lambdaNodeJs.NodejsFunction(stack, 'id', ...)

and then try to bundle the stack

yarn cdk synth

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.133.0

Framework Version

No response

Node.js Version

v22.1.0

OS

windows

Language

TypeScript

Language Version

5.4.3

Other information

No response

@smivanhamrah smivanhamrah added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 13, 2024
@ashishdhingra ashishdhingra self-assigned this Jun 13, 2024
@ashishdhingra ashishdhingra added needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 13, 2024
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Jun 13, 2024

Most likely a valid issue.

@smivanhamrah Good afternoon. Thanks for reporting the issue and drafting the PR. Could you please share the minimal reproducible code sample for us to troubleshoot the issue?

Thanks,
Ashish

@ashishdhingra ashishdhingra added p2 effort/small Small work item – less than a day of effort labels Jun 17, 2024
@ashishdhingra ashishdhingra removed their assignment Jun 17, 2024
@ashishdhingra ashishdhingra removed the needs-reproduction This issue needs reproduction. label Jun 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants