Closed
Description
Expected Behaviour
SAM Example should build successfully with node 18.x version.
Current Behaviour
sam build
Building codeuri: /codebuild/output/src099275065/src/Middy-Crud runtime: nodejs18.x metadata: {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'ES2020', 'Sourcemap': True, 'EntryPoints': ['src/GetAllItems/get-all-items.ts']}} architecture: x86_64 functions: GetAllItems
Build Failed
Error: 'nodejs18.x' runtime is not supported
Code snippet
Globals:
Function:
Runtime: nodejs18.x
Architectures:
- x86_64
MemorySize: 128
Timeout: 100
Resources:
GetAllItems:
Type: AWS::Serverless::Function
Properties:
Handler: src/GetAllItems/get-all-items.handler
Description: A simple example includes a HTTP get method to get all items from a DynamoDB table.
Policies:
# Give Create/Read/Update/Delete Permissions to the SampleTable
- DynamoDBReadPolicy:
TableName: !Ref SampleTable
Tracing: Active
Environment:
Variables:
# Make table name accessible as environment variable from function code during execution
NODE_OPTIONS: '--enable-source-maps' # see https://docs.aws.amazon.com/lambda/latest/dg/typescript-exceptions.html
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1 # see https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-reusing-connections.html
SAMPLE_TABLE: !Ref SampleTable
POWERTOOLS_SERVICE_NAME: QSGetAllItemsService
POWERTOOLS_METRICS_NAMESPACE: QSGetAllItemsService
LOG_LEVEL: Debug
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref ApiGatewayApi
Path: /
Method: GET
Metadata:
# Manage esbuild properties
BuildMethod: esbuild
BuildProperties:
Minify: true
Target: "ES2020"
Sourcemap: true
EntryPoints:
- src/GetAllItems/get-all-items.ts
Possible Solution
No response
Steps to Reproduce
- npm install
- npm run build
AWS Lambda Powertools for TypeScript version
latest
AWS Lambda function runtime
18.x
Packaging format used
Npm
Execution logs
[Container] 2023/02/08 15:53:25 Running command n 18
installing : node-v18.14.0
mkdir : /usr/local/n/versions/node/18.14.0
fetch : https://nodejs.org/dist/v18.14.0/node-v18.14.0-linux-x64.tar.xz
copying : node/18.14.0
installed : v18.14.0 (with npm 9.3.1)
[Container] 2023/02/08 15:53:42 Running command node -v
v18.14.0
[Container] 2023/02/08 15:53:42 Running command echo "Verify AWS CLI Version..."
Verify AWS CLI Version...
[Container] 2023/02/08 15:53:42 Running command aws --version
aws-cli/2.8.1 Python/3.9.11 Linux/4.14.281-212.502.amzn2.x86_64 exec-env/AWS_ECS_EC2 exe/x86_64.ubuntu.22 prompt/off
[Container] 2023/02/08 15:53:53 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2023/02/08 15:53:53 Phase context status code: Message:
[Container] 2023/02/08 15:53:53 Entering phase BUILD
[Container] 2023/02/08 15:53:53 Running command cd Middy-Crud
[Container] 2023/02/08 15:53:53 Running command npm install
added 591 packages, and audited 592 packages in 17s
found 0 vulnerabilities
[Container] 2023/02/08 15:54:11 Running command npm run build
> middyqs@1.5.0 build
> sam build
SAM CLI now collects telemetry to better understand customer needs.
You can OPT OUT and disable telemetry collection by setting the
environment variable SAM_CLI_TELEMETRY=0 in your shell.
Thanks for your help!
Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html
Building codeuri: /codebuild/output/src099275065/src/Middy-Crud runtime: nodejs18.x metadata: {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'ES2020', 'Sourcemap': True, 'EntryPoints': ['src/GetAllItems/get-all-items.ts']}} architecture: x86_64 functions: GetAllItems
Build Failed
Error: 'nodejs18.x' runtime is not supported