Open jusdino opened 15 hours ago
Issue reproducible using below code:
import os
from aws_cdk import (
# Duration,
Stack,
aws_ec2 as ec2,
aws_lambda as awslambda,
aws_lambda_nodejs as lambdanodejs
)
from constructs import Construct
class CdktestPythonStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
lambdanodejs.NodejsFunction(
self,
'BrokenFunction',
runtime=awslambda.Runtime.NODEJS_22_X,
entry=os.path.join('local_folder', 'index.js'),
handler='index.handler',
deps_lock_file_path=os.path.join('local_folder', 'package-lock.json'),
)
Running cdk synth
gives below error:
#0 building with "desktop-linux" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.36kB done
#1 DONE 0.0s
#2 [internal] load metadata for public.ecr.aws/sam/build-nodejs22.x:latest
#2 ERROR: public.ecr.aws/sam/build-nodejs22.x:latest: not found
------
> [internal] load metadata for public.ecr.aws/sam/build-nodejs22.x:latest:
------
Dockerfile:4
--------------------
2 | # passed as build arg. The default allows to do `docker build .` when testing.
3 | ARG IMAGE=public.ecr.aws/sam/build-nodejs18.x
4 | >>> FROM $IMAGE
5 |
6 | # Install yarn
--------------------
ERROR: failed to solve: public.ecr.aws/sam/build-nodejs22.x: failed to resolve source metadata for public.ecr.aws/sam/build-nodejs22.x:latest: public.ecr.aws/sam/build-nodejs22.x:latest: not found
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/plw3vyn4s1v06ommx868bqe5c
jsii.errors.JavaScriptError:
Error: docker exited with status 1
--> Command: docker build -t cdk-0093a40e620649ff7aea9f457996457645f33db41a5d05fd2c7487ac204070de --platform "linux/amd64" --build-arg "IMAGE=public.ecr.aws/sam/build-nodejs22.x" --build-arg "ESBUILD_VERSION=0.21"
...
Examining Image Tags at https://gallery.ecr.aws/sam/build-nodejs22.x, it appears that as of now, there is no image tagged as latest
(as compared to https://gallery.ecr.aws/sam/build-nodejs20.x).
@jusdino This appears to be sync problem across different teams. Could you please open issue at https://github.com/aws/aws-sam-cli so that you get any updates as the issue is being worked upon?
Thanks, Ashish
Thanks @jusdino for raising this issue. As you mentioned, the image creation is handled by sam-cli team, and they are currently working on it. It will be available soon. I will update the issue once the image is available.
The image is available now. Please check if it fixes your issue.
Yep, issue fixed now that the Node 22_X images are available. Thanks!
Any chance there's a way to reduce turbulence between the teams for whenever Node 24 comes out?
Describe the bug
It appears that aws-cdk-lib (2.169.0 at least) was updated to include Runtime.NODEJS_22_X before the corresponding SAM docker image that NodeJSFunction uses is available: https://gallery.ecr.aws/sam/build-nodejs22.x
So trying to build functions with the latest runtime fails to synth:
Regression Issue
Last Known Working CDK 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
Node 20_x builds, Node 22_x does not
Possible Solution
Ideally, ask the sam team to get an image out? (or maybe even coordinate timing of future runtime updates in CDK releases with SAM image availability?) Until then, a more helpful error message or something might help reduce thrash as developers do what I did:
Additional Information/Context
No response
CDK CLI Version
2.169.0
Framework Version
No response
Node.js Version
22.1.0
OS
MacOS
Language
Python
Language Version
3.12.3
Other information
No response