aws / aws/aws-cdk

aws_lambda_nodejs: NodeJSFunction fails with Runtime.NODEJS_24_X

Open
#36,113 4 comments 8 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda-nodejs bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

It appears that aws-cdk-lib (2.225.0 at least) was updated to include Runtime.NODEJS_24_X before the corresponding SAM docker image that NodeJSFunction uses is available:
https://gallery.ecr.aws/sam/build-nodejs24.x

This looks like a repeat of the [same issue](https://github.com/aws/aws-cdk/issues/32239) that came up with the NODEJS_22_X release.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

The function should bundle successfully

### Current Behavior

The function fails bundling when it attempts to pull down a container image that does not yet exist.

### Reproduction Steps

Create a basic cdk app with a JS lambda folder like
```
├── app.py
├── cdk.json
│ └── index.js
└── local_folder
├── index.js
├── package-lock.json
└── package.json
```
# app.py
```python
import os

from aws_cdk import App, Stack
from aws_cdk.aws_lambda import Runtime
from aws_cdk.aws_lambda_nodejs import NodejsFunction

app = App()
stack = Stack(app, 'Broken')
NodejsFunction(
stack,
'BrokenFunction',
runtime=Runtime.NODEJS_24_X,
entry=os.path.join('local_folder', 'index.js'),
deps_lock_file_path=os.path.join('local_folder', 'package-lock.json'),
handler='handler',
)
```

### Possible Solution

You really should coordinate with the SAM releases, as was suggested last time:
https://github.com/aws/aws-cdk/issues/32239#issuecomment-2492880920

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.224.0

### AWS CDK CLI version

2.1029.4 (build 09c0061)

### Node.js Version

v24.11.1

### OS

MacOs

### Language

Python

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the app.py reproduction and the NodejsFunction configured with Runtime.NODEJS_24_X; inspect the local_folder package files and the SAM build-nodejs24.x image reference. Verify whether the image is available and compare this failure with the linked NODEJS_22_X issue. Done means the function bundles successfully with the requested runtime or the coordination gap is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, node.js, python, typescript
Domain
build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.