Skip to content

Commit

Permalink
⬆️ (node) upgrade from v14 to v20
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 20, 2024
1 parent f79c1be commit 216b027
Show file tree
Hide file tree
Showing 8 changed files with 1,610 additions and 269 deletions.
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@
"mysql": "^2.18.1",
"numbers": "^0.7.0",
"point-in-polygon": "^1.0.1",
"serverless-mysql": "^1.2.0"
"serverless-mysql": "^1.5.5"
},
"devDependencies": {
"@aws-sdk/client-api-gateway": "^3.496.0",
"@aws-sdk/client-cloudwatch": "^3.496.0",
"@aws-sdk/client-sns": "^3.496.0",
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.4.3",
"apollo-server-testing": "^2.3.1",
Expand All @@ -57,12 +60,12 @@
"lint-staged": "^12.1.4",
"mockdate": "^3.0.2",
"prettier": "^2.0.1",
"serverless": "^3.17.0",
"serverless": "^3.38.0",
"serverless-domain-manager": "^6.0.3",
"serverless-layers": "^2.3.3",
"serverless-layers": "^2.7.0",
"serverless-offline": "8.5.0",
"serverless-plugin-aws-alerts": "^1.7.1",
"serverless-webpack": "^5.2.0",
"serverless-plugin-aws-alerts": "^1.7.5",
"serverless-webpack": "^5.13.0",
"sqlite3": "^5.0.2",
"webpack": "^5.11.1",
"webpack-node-externals": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ useDotenv: true
provider:
name: aws
region: eu-west-1
runtime: nodejs14.x
runtime: nodejs20.x
architecture: arm64
stage: ${opt:stage, 'dev'}
logRetentionInDays: 7
Expand Down
20 changes: 10 additions & 10 deletions src/lib/api-gateway.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import AWS from 'aws-sdk';
import {
APIGatewayClient,
GetApiKeyCommand,
} from '@aws-sdk/client-api-gateway';

const apiGateway = new AWS.APIGateway({
apiVersion: '2015-07-09',
});
const client = new APIGatewayClient();

const keyCache = new Map();

Expand All @@ -11,12 +12,11 @@ export async function getApiKey(id) {
return keyCache.get(id);
}

const data = await apiGateway
.getApiKey({
apiKey: id,
includeValue: false,
})
.promise();
const command = new GetApiKeyCommand({
apiKey: id,
includeValue: false,
});
const data = await client.send(command);

keyCache.set(id, data);
return data;
Expand Down
21 changes: 0 additions & 21 deletions src/lib/api-gateway.test.js

This file was deleted.

10 changes: 7 additions & 3 deletions src/lib/cloudwatch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import AWS from 'aws-sdk';
import {
CloudWatchClient,
PutMetricDataCommand,
} from '@aws-sdk/client-cloudwatch';

const cloudwatch = new AWS.CloudWatch({ apiVersion: '2010-08-01' });
const client = new CloudWatchClient();

export function putMetricData(data) {
return cloudwatch.putMetricData(data).promise();
const command = new PutMetricDataCommand(data);
return client.send(command);
}

export function logMetric(name, value, dimensions = []) {
Expand Down
10 changes: 3 additions & 7 deletions src/lib/sns.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import AWS from 'aws-sdk';
import { SNSClient, PublishCommand } from '@aws-sdk/client-sns';

AWS.config.update({ region: process.env.AWS_REGION });

const sns = new AWS.SNS({
apiVersion: '2012-11-05',
});
const client = new SNSClient({ region: process.env.AWS_REGION });

export function publish(message) {
return sns.publish(message).promise();
return client.send(new PublishCommand(message));
}
23 changes: 0 additions & 23 deletions src/lib/sns.test.js

This file was deleted.

Loading

0 comments on commit 216b027

Please sign in to comment.