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.68k stars 3.93k forks source link

aws-cdk-lib: NODEJS_LATEST still points to nodejs18.x #28125

Open MunchyYDL opened 11 months ago

MunchyYDL commented 11 months ago

Describe the bug

NODEJS_LATEST points to nodejs18.x even though nodejs20.x is available.

Not exactly sure if this should be considered a bug or a feature request?

I tried searching for any information regarding if the NODEJS_LATEST value change should be delayed because of some reason but couldn't find anything. Tried to ask about it here as well #28046, but haven't received any response there yet.

Expected Behavior

NODEJS_LATEST should return nodejs20.x

Current Behavior

NODEJS_LATEST returns nodejs18.x This is where you can find the code: aws-cdk-lib/aws-lambda/lib/runtime.js

  /**
   * The latest NodeJS version currently available
   */
  public static readonly NODEJS_LATEST = new Runtime('nodejs18.x', RuntimeFamily.NODEJS, { supportsInlineCode: true, isVariable: true });

Reproduction Steps

Just use the NODEJS_LATEST

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.110.1 (build 0d37f0d)

Framework Version

No response

Node.js Version

v20.9.0

OS

macOS

Language

TypeScript

Language Version

TypeScript v5.2.2

Other information

No response

khushail commented 11 months ago

Hi @MunchyYDL , Thnaks for reaching out. There is already work being done on upgrading the lambda runtime to NodeJS20 as the latest. It is being tracked here.

MunchyYDL commented 11 months ago

HI @khushail, thanks for the information, I will close my own attempts to fix this then, and leave it to you guys! 👍

github-actions[bot] commented 11 months ago

⚠️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.

kaizencc commented 11 months ago

Reopening this because #27003 tracks CDK's transition from node18 to node20 in our underlying custom resources. This ticket tracks NODEJS_LATEST's move to node20, which will happen when the runtime exists in all regions.

MunchyYDL commented 11 months ago

Sorry, I thought you meant that there were other issues tracking this, I just wanted to clean up after myself.

And oh, do you have any more information about when nodejs20.x will be available in all regions, as my impressions from this article: Node.js 20.x runtime now available in AWS Lambda, was that it was available everywhere. 🤔 Or do you know where I can find more information about it?

That was actually some of my initial concerns, that I couldn't find any rules about if NODEJS_LATEST was supposed to still point to nodejs18.x or not.

unstubbable commented 9 months ago

@kaizencc Is this still on your radar? Also, I can't find any info that Node 20 is only available in certain regions (e.g. https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html, or https://aws.amazon.com/blogs/compute/node-js-20-x-runtime-now-available-in-aws-lambda/). Can you confirm that this is still the case, and maybe point me to a source?

scanlonp commented 6 months ago

Hey @MunchyYDL and @unstubbable, this blog post is where I see a reference to Node 20 not being available in all regions.

Thank you for bringing this issue up, and it is on our radar. We have some ideas on making NODEJS_LATEST represent the latest version rather than the "latest available in all regions". I think it would be better for my mental model of what the variable does, but let me know your thoughts! And we will update you with what decisions we make.

automartin5000 commented 6 months ago

Hey @MunchyYDL and @unstubbable, this blog post is where I see a reference to Node 20 not being available in all regions.

Thank you for bringing this issue up, and it is on our radar. We have some ideas on making NODEJS_LATEST represent the latest version rather than the "latest available in all regions". I think it would be better for my mental model of what the variable does, but let me know your thoughts! And we will update you with what decisions we make.

Selfishly, I'd want NODEJS_LATEST to always point to the latest runtime available in most regions, especially not including GovCloud or China. That said, I could see the broad usefulness of the variable to ensure random Lambda functions, like custom resources, that don't get updated much, are always on at least a supported version.

Given that, I might suggest a new variable: NODEJS_LATEST_GLOBAL that is available for all regions and NODEJS_LATEST that is the most commonly available latest. Alternatively, you could create a variable specially for not 100% available latest, if you're trying to prevent a breaking change. I just can't think of what that would be called off the top of my head. Maybe NODEJS_BLEEDING_EDGE? 😏

colifran commented 6 months ago

@automartin5000 I'm working on a PR that adds region awareness for node runtimes to our custom resources. I think it would make sense to point NODEJS_LATEST at this as well. We will be maintaining a fact table that keeps track of the latest node runtime available based on partition.

michael-k commented 4 weeks ago

The nodejs20.x runtime is now (since 2024-09-23) available in the gov cloud: https://aws.amazon.com/about-aws/whats-new/2024/09/aws-lambda-linux-2023-runtimes-govcloud-regions/

Found no public information about the china regions :shrug:

Region awareness for (node) runtimes would be great though.