aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.34k stars 3.76k forks source link

aws-cdk: npx cdk deploy not working in a github action #29090

Open stuller-adriahuertascaparros opened 4 months ago

stuller-adriahuertascaparros commented 4 months ago

Describe the bug

After updating Node from 16 to 18, the command npx cdk delpoy inside a github action doesn't work. The deploy doesn't happen and it doesn't raise any kind of error. We have the aws-cdk-lib: 2.19 and cdk: 2.19 packages in our project.

Expected Behavior

With node 16 (works fine) Screenshot 2024-02-13 115008

Current Behavior

With node 18 (no deploy and no error) Screenshot 2024-02-13 115049

Reproduction Steps

We have just changed the node version from 16 to 18 in the github action that runs the command npx cdk deploy

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.19

Framework Version

No response

Node.js Version

18

OS

Ubuntu

Language

TypeScript

Language Version

Typescript (4.6.3)

Other information

No response

pahud commented 4 months ago

cdk 2.19.0 was released in April 2022 and it might not have full test with node18. I am wondering:

  1. Are you able to deploy that using your local machine instead of github actions?
  2. Are you able to deploy that using the latest CDK release in github actions?
stuller-adriahuertascaparros commented 4 months ago

cdk 2.19.0 was released in April 2022 and it might not have full test with node18. I am wondering:

1. Are you able to deploy that using your local machine instead of github actions?

2. Are you able to deploy that using the latest CDK release in github actions?
  1. I haven't tried that for now
  2. The instruction we run is "npx cdk deploy...". I've tried updating both cdk and aws-cdk-lib packages to the last version and it didn't work. What did work was changing the command: npx cdk delpoy... for: npm i -g aws-cdk@latest cdk deploy...

So, I'm quite new to aws and I'm not sure what is the difference between aws-cdk and aws-cdk-lib but if I don't want to install aws-cdk in the github action and I want to keep running the same command I guess I should install latest aws-cdk in my project and then using npx would be equivalent to install it globally in the github action. Am I right?

stuller-adriahuertascaparros commented 4 months ago

I've just realised that making this only change, even without updating cdk and aws-cdk-lib packages, it works: npx cdk deploy... for: npx aws-cdk deploy

I've seen that aws docs recommends installing aws-cdk globally and running cdk deploy. But I've checked the cdk package in npm repositories and its current version is the same as aws-cdk, which has led me to think it should be updated and functional.

So, is the package cdk in npm deprecated? What's exactly happening when running "npx cdk deploy..." and what's the difference when running "npx aws-cdk deploy..."? Can someone shed some light?