Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Commit fe5863f

Browse files
authored
feat: use Node.js 14 (#3)
1 parent 9dddbf0 commit fe5863f

9 files changed

Lines changed: 41 additions & 14 deletions

cdk/resources/CellGeolocation.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as SQS from '@aws-cdk/aws-sqs'
1414
import { LambdasWithLayer } from './LambdasWithLayer'
1515
import { CORE_STACK_NAME } from '../stacks/stackName'
1616
import { enabledInContext } from '../helper/enabledInContext'
17+
import { NodeJS14Runtime } from './NodeJS14Runtime'
1718

1819
/**
1920
* Provides the resources for geolocating LTE/NB-IoT network cells
@@ -55,7 +56,8 @@ export class CellGeolocation extends CloudFormation.Resource {
5556
const fromCache = new Lambda.Function(this, 'fromCache', {
5657
layers: lambdas.layers,
5758
handler: 'index.handler',
58-
runtime: Lambda.Runtime.NODEJS_12_X,
59+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
60+
runtime: NodeJS14Runtime,
5961
timeout: CloudFormation.Duration.seconds(10),
6062
memorySize: 1792,
6163
code: lambdas.lambdas.geolocateCellFromCacheStepFunction,
@@ -116,7 +118,8 @@ export class CellGeolocation extends CloudFormation.Resource {
116118
const fromDevices = new Lambda.Function(this, 'fromDevices', {
117119
layers: lambdas.layers,
118120
handler: 'index.handler',
119-
runtime: Lambda.Runtime.NODEJS_12_X,
121+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
122+
runtime: NodeJS14Runtime,
120123
timeout: CloudFormation.Duration.seconds(10),
121124
memorySize: 1792,
122125
code: lambdas.lambdas.geolocateCellFromDeviceLocationsStepFunction,
@@ -143,7 +146,8 @@ export class CellGeolocation extends CloudFormation.Resource {
143146
const addToCache = new Lambda.Function(this, 'addToCache', {
144147
layers: lambdas.layers,
145148
handler: 'index.handler',
146-
runtime: Lambda.Runtime.NODEJS_12_X,
149+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
150+
runtime: NodeJS14Runtime,
147151
timeout: CloudFormation.Duration.minutes(1),
148152
memorySize: 1792,
149153
code: lambdas.lambdas.cacheCellGeolocationStepFunction,
@@ -174,7 +178,8 @@ export class CellGeolocation extends CloudFormation.Resource {
174178
fromUnwiredLabs = new Lambda.Function(this, 'fromUnwiredLabs', {
175179
layers: lambdas.layers,
176180
handler: 'index.handler',
177-
runtime: Lambda.Runtime.NODEJS_12_X,
181+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
182+
runtime: NodeJS14Runtime,
178183
timeout: CloudFormation.Duration.seconds(10),
179184
memorySize: 1792,
180185
code: lambdas.lambdas.geolocateCellFromUnwiredLabsStepFunction,
@@ -412,7 +417,8 @@ export class CellGeolocation extends CloudFormation.Resource {
412417

413418
const fromSQS = new Lambda.Function(this, 'fromSQS', {
414419
handler: 'index.handler',
415-
runtime: Lambda.Runtime.NODEJS_12_X,
420+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
421+
runtime: NodeJS14Runtime,
416422
timeout: CloudFormation.Duration.seconds(10),
417423
memorySize: 1792,
418424
code: lambdas.lambdas.invokeStepFunctionFromSQS,

cdk/resources/CellGeolocationApi.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { CellGeolocation } from './CellGeolocation'
88
import { LambdasWithLayer } from './LambdasWithLayer'
99
import * as CloudWatchLogs from '@aws-cdk/aws-logs'
1010
import { LambdaLogGroup } from './LambdaLogGroup'
11+
import { NodeJS14Runtime } from './NodeJS14Runtime'
1112

1213
/**
1314
* Allows to resolve cell geolocations using a HTTP API
@@ -35,7 +36,8 @@ export class CellGeolocationApi extends CloudFormation.Resource {
3536
const getCell = new Lambda.Function(this, 'getCell', {
3637
layers: lambdas.layers,
3738
handler: 'index.handler',
38-
runtime: Lambda.Runtime.NODEJS_12_X,
39+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
40+
runtime: NodeJS14Runtime,
3941
timeout: CloudFormation.Duration.seconds(10),
4042
memorySize: 1792,
4143
code: lambdas.lambdas.geolocateCellHttpApi,
@@ -64,7 +66,8 @@ export class CellGeolocationApi extends CloudFormation.Resource {
6466
const addCell = new Lambda.Function(this, 'addCell', {
6567
layers: lambdas.layers,
6668
handler: 'index.handler',
67-
runtime: Lambda.Runtime.NODEJS_12_X,
69+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
70+
runtime: NodeJS14Runtime,
6871
timeout: CloudFormation.Duration.seconds(10),
6972
memorySize: 1792,
7073
code: lambdas.lambdas.addCellGeolocationHttpApi,

cdk/resources/HistoricalData.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { logToCloudWatch } from './logToCloudWatch'
77
import { LambdaLogGroup } from './LambdaLogGroup'
88
import { AssetTrackerLambdas } from '../prepare-resources'
99
import { LambdasWithLayer } from './LambdasWithLayer'
10+
import { NodeJS14Runtime } from './NodeJS14Runtime'
1011

1112
/**
1213
* Provides resources for historical data
@@ -64,7 +65,8 @@ export class HistoricalData extends CloudFormation.Resource {
6465
const storeMessagesInTimestream = new Lambda.Function(this, 'lambda', {
6566
layers: lambdas.layers,
6667
handler: 'index.handler',
67-
runtime: Lambda.Runtime.NODEJS_12_X,
68+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
69+
runtime: NodeJS14Runtime,
6870
timeout: CloudFormation.Duration.minutes(2),
6971
memorySize: 1792,
7072
code: lambdas.lambdas.storeMessagesInTimestream,

cdk/resources/NodeJS14Runtime.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Lambda from '@aws-cdk/aws-lambda'
2+
3+
export const NodeJS14Runtime = new Lambda.Runtime(
4+
'nodejs14.x',
5+
Lambda.RuntimeFamily.NODEJS,
6+
{
7+
supportsInlineCode: false,
8+
},
9+
)

cdk/resources/ThingGroupLambda.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { logToCloudWatch } from './logToCloudWatch'
55
import { CDKLambdas } from '../prepare-resources'
66
import { LambdasWithLayer } from './LambdasWithLayer'
77
import { LambdaLogGroup } from './LambdaLogGroup'
8+
import { NodeJS14Runtime } from './NodeJS14Runtime'
89

910
export class ThingGroupLambda extends CloudFormation.Resource {
1011
public readonly function: Lambda.IFunction
@@ -25,7 +26,8 @@ export class ThingGroupLambda extends CloudFormation.Resource {
2526
description:
2627
'Used in CloudFormation to create the thing group for the devices',
2728
handler: 'index.handler',
28-
runtime: Lambda.Runtime.NODEJS_12_X,
29+
// runtime: Lambda.Runtime.NODEJS_14_X, // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
30+
runtime: NodeJS14Runtime,
2931
timeout: CloudFormation.Duration.minutes(1),
3032
initialPolicy: [
3133
new IAM.PolicyStatement({

cdk/resources/WebAppCD.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class WebAppCD extends CloudFormation.Construct {
7272
environment: {
7373
type: 'LINUX_CONTAINER',
7474
computeType: 'BUILD_GENERAL1_LARGE',
75-
image: 'aws/codebuild/standard:3.0',
75+
image: 'aws/codebuild/standard:5.0',
7676
environmentVariables: [
7777
{
7878
name: 'STACK_NAME',

cdk/stacks/AssetTracker.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { LambdasWithLayer } from '../resources/LambdasWithLayer'
2121
import { lambdasOnS3 } from '../resources/lambdasOnS3'
2222
import { HistoricalData } from '../resources/HistoricalData'
2323
import { warn } from '../helper/note'
24+
import { NodeJS14Runtime } from '../resources/NodeJS14Runtime'
2425

2526
export class AssetTrackerStack extends CloudFormation.Stack {
2627
public constructor(
@@ -56,7 +57,8 @@ export class AssetTrackerStack extends CloudFormation.Stack {
5657
sourceCodeBucket,
5758
packedLambdas.layerZipFileName,
5859
),
59-
compatibleRuntimes: [Lambda.Runtime.NODEJS_12_X],
60+
// compatibleRuntimes: [Lambda.Runtime.NODEJS_14_X], // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
61+
compatibleRuntimes: [NodeJS14Runtime],
6062
},
6163
)
6264

@@ -68,7 +70,8 @@ export class AssetTrackerStack extends CloudFormation.Stack {
6870
sourceCodeBucket,
6971
packedCDKLambdas.layerZipFileName,
7072
),
71-
compatibleRuntimes: [Lambda.Runtime.NODEJS_12_X],
73+
// compatibleRuntimes: [Lambda.Runtime.NODEJS_14_X], // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
74+
compatibleRuntimes: [NodeJS14Runtime],
7275
},
7376
)
7477

cdk/stacks/ContinuousDeployment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class ContinuousDeploymentStack extends CloudFormation.Stack {
148148
environment: {
149149
type: 'LINUX_CONTAINER',
150150
computeType: 'BUILD_GENERAL1_LARGE',
151-
image: 'aws/codebuild/standard:3.0',
151+
image: 'aws/codebuild/standard:5.0',
152152
environmentVariables: [
153153
{
154154
name: 'GH_TOKEN',

cdk/stacks/FirmwareCI.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { CORE_STACK_NAME, FIRMWARE_CI_STACK_NAME } from './stackName'
88
import { lambdasOnS3 } from '../resources/lambdasOnS3'
99
import * as IAM from '@aws-cdk/aws-iam'
1010
import { Fn } from '@aws-cdk/core'
11+
import { NodeJS14Runtime } from '../resources/NodeJS14Runtime'
1112

1213
export class FirmwareCIStack extends CloudFormation.Stack {
1314
public constructor(
@@ -39,7 +40,8 @@ export class FirmwareCIStack extends CloudFormation.Stack {
3940
sourceCodeBucket,
4041
packedCDKLambdas.layerZipFileName,
4142
),
42-
compatibleRuntimes: [Lambda.Runtime.NODEJS_12_X],
43+
// compatibleRuntimes: [Lambda.Runtime.NODEJS_14_X], // FIXME: use once CDK has support. See https://github.com/aws/aws-cdk/pull/12861
44+
compatibleRuntimes: [NodeJS14Runtime],
4345
},
4446
)
4547

0 commit comments

Comments
 (0)