Skip to content

Commit e1a2c4f

Browse files
authored
fix(sam): deprecate nodejs 12.x #3853
No longer supported by Lambda. https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
1 parent af99d5a commit e1a2c4f

File tree

15 files changed

+40
-51
lines changed

15 files changed

+40
-51
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Deprecation",
3+
"description": "SAM: removed support for Node.js 12.x [Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)"
4+
}

README.quickstart.cloud9.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ When you're satisfied with performance, you can [deploy your serverless applicat
8888

8989
The Toolkit _local SAM debugging_ feature supports these runtimes:
9090

91-
- JavaScript (Node.js 12.x, 14.x)
91+
- JavaScript (Node.js 14.x, 16.x)
9292
- Python (3.7, 3.8, 3.9, 3.10, 3.11)
9393

9494
For more information see [Working with AWS Serverless Applications](https://docs.aws.amazon.com/cloud9/latest/user-guide/serverless-apps-toolkit.html) in the user guide.

src/apprunner/wizards/codeRepositoryWizard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function createBranchPrompter(
8888
function createRuntimePrompter(): QuickPickPrompter<AppRunner.Runtime> {
8989
const items = [
9090
{ label: 'python3', data: 'PYTHON_3' },
91-
{ label: 'nodejs12', data: 'NODEJS_12' },
91+
{ label: 'nodejs12', data: 'NODEJS_16' },
9292
]
9393

9494
return createQuickPick(items, {

src/lambda/models/samLambdaRuntime.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ export type RuntimePackageType = 'Image' | 'Zip'
2828

2929
// TODO: Consolidate all of the runtime constructs into a single <Runtime, Set<Runtime>> map
3030
// We should be able to eliminate a fair amount of redundancy with that.
31-
export const nodeJsRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
32-
'nodejs18.x',
33-
'nodejs16.x',
34-
'nodejs14.x',
35-
'nodejs12.x',
36-
])
31+
export const nodeJsRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>(['nodejs18.x', 'nodejs16.x', 'nodejs14.x'])
3732
export function getNodeMajorVersion(version?: string): number | undefined {
3833
if (!version) {
3934
return undefined
@@ -98,7 +93,6 @@ export const samArmLambdaRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>
9893
'nodejs18.x',
9994
'nodejs16.x',
10095
'nodejs14.x',
101-
'nodejs12.x',
10296
'java11',
10397
'java8.al2',
10498
])

src/lambda/models/samTemplates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,5 @@ export function supportsStepFuntionsTemplate(samCliVersion: string): boolean {
131131
}
132132

133133
export function supportsTypeScriptBackendTemplate(runtime: Runtime): boolean {
134-
return runtime === 'nodejs12.x'
134+
return runtime === 'nodejs16.x'
135135
}

src/test/lambda/models/samLambdaRuntime.test.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ describe('compareSamLambdaRuntime', async function () {
2222
lowerRuntime: Runtime
2323
higherRuntime: Runtime
2424
}[] = [
25-
{ lowerRuntime: 'nodejs12.x', higherRuntime: 'nodejs14.x' },
26-
{ lowerRuntime: 'nodejs14.x', higherRuntime: 'nodejs14.x (Image)' },
27-
{ lowerRuntime: 'nodejs12.x (Image)', higherRuntime: 'nodejs14.x' },
25+
{ lowerRuntime: 'nodejs14.x', higherRuntime: 'nodejs16.x' },
26+
{ lowerRuntime: 'nodejs16.x', higherRuntime: 'nodejs16.x (Image)' },
27+
{ lowerRuntime: 'nodejs14.x (Image)', higherRuntime: 'nodejs16.x' },
2828
]
2929

3030
scenarios.forEach(scenario => {
@@ -69,7 +69,6 @@ describe('getFamily', function () {
6969
describe('runtimes', function () {
7070
it('cloud9', function () {
7171
assert.deepStrictEqual(samLambdaCreatableRuntimes(true).toArray().sort(), [
72-
'nodejs12.x',
7372
'nodejs14.x',
7473
'nodejs16.x',
7574
'nodejs18.x',
@@ -80,7 +79,6 @@ describe('runtimes', function () {
8079
'python3.9',
8180
])
8281
assert.deepStrictEqual(samImageLambdaRuntimes(true).toArray().sort(), [
83-
'nodejs12.x',
8482
'nodejs14.x',
8583
'nodejs16.x',
8684
'nodejs18.x',
@@ -99,7 +97,6 @@ describe('runtimes', function () {
9997
'java11',
10098
'java8',
10199
'java8.al2',
102-
'nodejs12.x',
103100
'nodejs14.x',
104101
'nodejs16.x',
105102
'nodejs18.x',
@@ -117,7 +114,6 @@ describe('runtimes', function () {
117114
'java11',
118115
'java8',
119116
'java8.al2',
120-
'nodejs12.x',
121117
'nodejs14.x',
122118
'nodejs16.x',
123119
'nodejs18.x',
@@ -131,14 +127,9 @@ describe('runtimes', function () {
131127
})
132128

133129
describe('getNodeMajorVersion()', () => {
134-
it('returns 12 on "nodejs12.x"', () => {
135-
const version = getNodeMajorVersion('nodejs12.x')
136-
assert.strictEqual(version, 12)
137-
})
138-
139-
it('returns 18 on "nodejs18.x"', () => {
140-
const version = getNodeMajorVersion('nodejs18.x')
141-
assert.strictEqual(version, 18)
130+
it('returns node version', () => {
131+
assert.strictEqual(getNodeMajorVersion('nodejs12.x'), 12)
132+
assert.strictEqual(getNodeMajorVersion('nodejs18.x'), 18)
142133
})
143134

144135
it('returns undefined on invalid input', () => {

src/test/lambda/models/samTemplates.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { samZipLambdaRuntimes } from '../../../lambda/models/samLambdaRuntime'
2424

2525
let validTemplateOptions: Set<SamTemplate>
2626
let validPythonTemplateOptions: Set<SamTemplate>
27-
let validNode12TemplateOptions: Set<SamTemplate>
27+
let validNodeTemplateOptions: Set<SamTemplate>
2828
let validGoTemplateOptions: Set<SamTemplate>
2929
let defaultTemplateOptions: Set<SamTemplate>
3030

@@ -46,7 +46,7 @@ before(function () {
4646
stepFunctionsSampleApp,
4747
])
4848

49-
validNode12TemplateOptions = Set([helloWorldTemplate, stepFunctionsSampleApp, typeScriptBackendTemplate])
49+
validNodeTemplateOptions = Set([helloWorldTemplate, stepFunctionsSampleApp, typeScriptBackendTemplate])
5050

5151
validGoTemplateOptions = Set([
5252
helloWorldTemplate,
@@ -74,11 +74,11 @@ describe('getSamTemplateWizardOption', function () {
7474
'Python 3.x supports additional template options'
7575
)
7676
break
77-
case 'nodejs12.x':
77+
case 'nodejs16.x':
7878
assert.deepStrictEqual(
7979
result,
80-
validNode12TemplateOptions,
81-
'Node12.x supports default and TS template options'
80+
validNodeTemplateOptions,
81+
'Node supports default and TS template options'
8282
)
8383
break
8484
case 'go1.x':

src/test/lambda/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ describe('lambda utils', async function () {
1010
describe('getLambdaDetails', function () {
1111
it('returns valid filenames and function names', function () {
1212
const jsNonNestedParsedName = getLambdaDetails({
13-
Runtime: 'nodejs12.x',
13+
Runtime: 'nodejs16.x',
1414
Handler: 'app.lambda_handler',
1515
})
1616
const pyNonNestedParsedName = getLambdaDetails({
1717
Runtime: 'python3.8',
1818
Handler: 'app.lambda_handler',
1919
})
2020
const jsNestedParsedName = getLambdaDetails({
21-
Runtime: 'nodejs12.x',
21+
Runtime: 'nodejs16.x',
2222
Handler: 'asdf/jkl/app.lambda_handler',
2323
})
2424
const node18ModuleParsedName = getLambdaDetails({

src/test/shared/cloudformation/yaml/template_api_endpoint_configuration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Resources:
1515
Properties:
1616
CodeUri: s3://sam-demo-bucket/member_portal.zip
1717
Handler: index.gethtml
18-
Runtime: nodejs12.x
18+
Runtime: nodejs18.x
1919
Events:
2020
GetHtml:
2121
Type: Api

src/test/shared/cloudformation/yaml/template_api_request_model.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Resources:
66
Properties:
77
CodeUri: s3://sam-demo-bucket/member_portal.zip
88
Handler: index.gethtml
9-
Runtime: nodejs12.x
9+
Runtime: nodejs18.x
1010
Events:
1111
GetHtml:
1212
Type: Api

0 commit comments

Comments
 (0)