From 5fe4cd247dd8f5286bf8ec02f389b1c414596b96 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 5 Apr 2025 18:06:14 +0100 Subject: [PATCH] Update examples to use non-deprecated nodejs versions --- docs/cli-reference/print.md | 4 ++-- docs/events/apigateway.md | 4 ++-- docs/events/websocket.md | 2 +- docs/guides/credentials.md | 4 ++-- docs/guides/functions.md | 14 +++++++------- docs/guides/serverless.yml.md | 4 ++-- docs/guides/services.md | 6 +++--- docs/guides/variables.md | 2 +- .../lib/plugins/aws/invoke-local/index.test.js | 14 +++++++------- ...trip-null-props-from-template-resources.test.js | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/cli-reference/print.md b/docs/cli-reference/print.md index b073822ae7..f98d3b9619 100644 --- a/docs/cli-reference/print.md +++ b/docs/cli-reference/print.md @@ -30,7 +30,7 @@ custom: provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x functions: hello: @@ -53,7 +53,7 @@ custom: bucketName: test provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x stage: dev # <-- Resolved functions: hello: diff --git a/docs/events/apigateway.md b/docs/events/apigateway.md index 3b633d4f3c..d84ed239c3 100644 --- a/docs/events/apigateway.md +++ b/docs/events/apigateway.md @@ -1456,7 +1456,7 @@ service: my-api provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x stage: dev region: eu-west-2 @@ -1645,7 +1645,7 @@ Resource policies are policy documents that are used to control the invocation o ```yml provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x apiGateway: resourcePolicy: diff --git a/docs/events/websocket.md b/docs/events/websocket.md index 126e5f8b99..140a667bb5 100644 --- a/docs/events/websocket.md +++ b/docs/events/websocket.md @@ -61,7 +61,7 @@ service: serverless-ws-test provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x websocketsApiName: custom-websockets-api-name websocketsApiRouteSelectionExpression: $request.body.action # custom routes are selected by the value of the action property in the body websocketsDescription: Custom Serverless Websockets diff --git a/docs/guides/credentials.md b/docs/guides/credentials.md index fd1667df60..ace7c18902 100644 --- a/docs/guides/credentials.md +++ b/docs/guides/credentials.md @@ -127,7 +127,7 @@ You can even set up different profiles for different accounts, which can be used service: new-service provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x stage: dev profile: devProfile ``` @@ -175,7 +175,7 @@ This example `serverless.yml` snippet will load the profile depending upon the s service: new-service provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x profile: ${self:custom.profiles.${sls:stage}} custom: profiles: diff --git a/docs/guides/functions.md b/docs/guides/functions.md index c6dc89d790..64be5c59a8 100644 --- a/docs/guides/functions.md +++ b/docs/guides/functions.md @@ -12,7 +12,7 @@ service: myService provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x runtimeManagement: auto # optional, set how Lambda controls all functions runtime. AWS default is auto; this can either be 'auto' or 'onFunctionUpdate'. For 'manual', see example in hello function below (syntax for both is identical) memorySize: 512 # optional, in MB, default is 1024 timeout: 10 # optional, in seconds, default is 6 @@ -52,7 +52,7 @@ service: myService provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x functions: functionOne: @@ -72,7 +72,7 @@ service: myService provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x memorySize: 512 # will be inherited by all functions functions: @@ -88,7 +88,7 @@ service: myService provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x functions: functionOne: @@ -124,7 +124,7 @@ service: myService provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x iam: role: statements: # permissions for all of your functions can be set here @@ -725,7 +725,7 @@ service: service provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x functions: hello: @@ -778,7 +778,7 @@ service: myService provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x tracing: lambda: true ``` diff --git a/docs/guides/serverless.yml.md b/docs/guides/serverless.yml.md index d9c7153d56..76605699e8 100644 --- a/docs/guides/serverless.yml.md +++ b/docs/guides/serverless.yml.md @@ -101,7 +101,7 @@ Some function settings can be defined for all functions inside the `provider` ke # serverless.yml provider: - runtime: nodejs14.x + runtime: nodejs18.x runtimeManagement: auto # optional, set how Lambda controls all functions runtime. AWS default is auto; this can either be 'auto' or 'onFunctionUpdate'. For 'manual', see example in hello function below (syntax for both is identical # Default memory size for functions (default: 1024MB) memorySize: 512 @@ -607,7 +607,7 @@ functions: # Container image to use. Cannot be used with 'handler'. # Can be the URI of an image in ECR, or the name of an image defined in 'provider.ecr.images' image: baseimage - runtime: nodejs14.x + runtime: nodejs18.x runtimeManagement: mode: manual # syntax required for manual, mode property also supports 'auto' or 'onFunctionUpdate' (see provider.runtimeManagement) arn: # required when mode is manual diff --git a/docs/guides/services.md b/docs/guides/services.md index 5849c9979e..6af6d2035d 100644 --- a/docs/guides/services.md +++ b/docs/guides/services.md @@ -85,7 +85,7 @@ service: users provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x stage: dev # Set the default stage used. Default is dev region: us-east-1 # Overwrite the default region used. Default is us-east-1 profile: production # The default profile to use with this service @@ -164,7 +164,7 @@ service: users provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x memorySize: 512 … @@ -181,7 +181,7 @@ service: users provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x memorySize: 512 … diff --git a/docs/guides/variables.md b/docs/guides/variables.md index 41b4f04990..66a4477cdb 100644 --- a/docs/guides/variables.md +++ b/docs/guides/variables.md @@ -199,7 +199,7 @@ You can add such custom output to CloudFormation stack. For example: service: another-service provider: name: aws - runtime: nodejs14.x + runtime: nodejs18.x region: ap-northeast-1 memorySize: 512 functions: diff --git a/test/unit/lib/plugins/aws/invoke-local/index.test.js b/test/unit/lib/plugins/aws/invoke-local/index.test.js index 45f307b291..da6802e2c7 100644 --- a/test/unit/lib/plugins/aws/invoke-local/index.test.js +++ b/test/unit/lib/plugins/aws/invoke-local/index.test.js @@ -421,7 +421,7 @@ describe('AwsInvokeLocal', () => { it(`should call invokeLocalNodeJs for any node.js runtime version for ${item.path}`, async () => { awsInvokeLocal.options.functionObj.handler = item.path; - awsInvokeLocal.options.functionObj.runtime = 'nodejs16.x'; + awsInvokeLocal.options.functionObj.runtime = 'nodejs18.x'; await awsInvokeLocal.invokeLocal(); expect(invokeLocalNodeJsStub.calledOnce).to.be.equal(true); expect( @@ -497,8 +497,8 @@ describe('AwsInvokeLocal', () => { expect(invokeLocalDockerStub.calledWithExactly()).to.be.equal(true); }); - it('should call invokeLocalDocker if using --docker option with nodejs16.x', async () => { - awsInvokeLocal.options.functionObj.runtime = 'nodejs16.x'; + it('should call invokeLocalDocker if using --docker option with nodejs18.x', async () => { + awsInvokeLocal.options.functionObj.runtime = 'nodejs18.x'; awsInvokeLocal.options.functionObj.handler = 'handler.foobar'; awsInvokeLocal.options.docker = true; await awsInvokeLocal.invokeLocal(); @@ -640,7 +640,7 @@ describe('AwsInvokeLocal', () => { handler: 'handler.hello', name: 'hello', timeout: 4, - runtime: 'nodejs16.x', + runtime: 'nodejs18.x', environment: { functionVar: 'functionValue', }, @@ -668,7 +668,7 @@ describe('AwsInvokeLocal', () => { expect(spawnExtStub.getCall(0).args).to.deep.equal(['docker', ['version']]); expect(spawnExtStub.getCall(1).args).to.deep.equal([ 'docker', - ['images', '-q', 'lambci/lambda:nodejs16.x'], + ['images', '-q', 'lambci/lambda:nodejs18.x'], ]); expect(spawnExtStub.getCall(3).args).to.deep.equal([ 'docker', @@ -699,7 +699,7 @@ describe('AwsInvokeLocal', () => { 'commandLineEnvVar=commandLineEnvVarValue', '-p', '9292:9292', - 'sls-docker-nodejs16.x', + 'sls-docker-nodejs18.x', 'handler.hello', '{}', ], @@ -993,7 +993,7 @@ describe('test/unit/lib/plugins/aws/invokeLocal/index.test.js', () => { }, configExt: { provider: { - runtime: 'nodejs14.x', + runtime: 'nodejs18.x', environment: { PROVIDER_LEVEL_VAR: 'PROVIDER_LEVEL_VAR_VALUE', NULL_VAR: null, diff --git a/test/unit/lib/plugins/aws/package/lib/strip-null-props-from-template-resources.test.js b/test/unit/lib/plugins/aws/package/lib/strip-null-props-from-template-resources.test.js index 2be5424ee4..890f22cfc1 100644 --- a/test/unit/lib/plugins/aws/package/lib/strip-null-props-from-template-resources.test.js +++ b/test/unit/lib/plugins/aws/package/lib/strip-null-props-from-template-resources.test.js @@ -43,7 +43,7 @@ describe('test/unit/lib/plugins/aws/package/lib/stripNullPropsFromTemplateResour Code: { S3Bucket: 's3-containing-lambda', }, - Runtime: 'nodejs16.x', + Runtime: 'nodejs18.x', }, }, resourceWithNullProperties: {