Skip to content

Commit 730f2c1

Browse files
committed
chore(maintenance): drop support for Node.js 14 (#1802)
1 parent 7cc38f8 commit 730f2c1

File tree

17 files changed

+1572
-448
lines changed

17 files changed

+1572
-448
lines changed

layers/src/layer-publisher-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class LayerPublisherStack extends Stack {
108108
'node_modules/@aws-sdk/**/README.md ',
109109
];
110110
const buildCommands: string[] = [];
111-
// We need these modules because they are not included in the nodejs14x and nodejs16x runtimes
111+
// We need these modules because they are not included in the nodejs16x runtimes
112112
const modulesToInstall: string[] = [
113113
'@aws-sdk/client-dynamodb',
114114
'@aws-sdk/util-dynamodb',

layers/tests/e2e/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const RESOURCE_NAME_PREFIX = 'Layers-E2E';
22
export const ONE_MINUTE = 60 * 1000;
33
export const TEST_CASE_TIMEOUT = 3 * ONE_MINUTE;
4-
export const SETUP_TIMEOUT = 5 * ONE_MINUTE;
4+
export const SETUP_TIMEOUT = 7 * ONE_MINUTE;
55
export const TEARDOWN_TIMEOUT = 5 * ONE_MINUTE;

package-lock.json

Lines changed: 1492 additions & 383 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,24 @@
4848
},
4949
"homepage": "https://github.com/aws-powertools/powertools-lambda-typescript#readme",
5050
"devDependencies": {
51-
"@middy/core": "^4.6.5",
52-
"@types/aws-lambda": "^8.10.121",
51+
"@middy/core": "^4.7.0",
52+
"@types/aws-lambda": "^8.10.129",
5353
"@types/jest": "^29.5.4",
54-
"@types/node": "^20.6.1",
55-
"@types/uuid": "^9.0.4",
56-
"@typescript-eslint/eslint-plugin": "^6.7.0",
57-
"@typescript-eslint/parser": "^6.7.0",
54+
"@types/node": "^20.9.5",
55+
"@typescript-eslint/eslint-plugin": "^6.12.0",
56+
"@typescript-eslint/parser": "^6.12.0",
5857
"eslint": "^8.49.0",
5958
"eslint-config-prettier": "^9.0.0",
6059
"eslint-import-resolver-node": "^0.3.9",
6160
"eslint-import-resolver-typescript": "^3.6.0",
6261
"eslint-plugin-import": "^2.28.1",
63-
"eslint-plugin-prettier": "^5.0.0",
62+
"eslint-plugin-prettier": "^5.0.1",
6463
"husky": "^8.0.3",
6564
"jest": "^29.7.0",
6665
"jest-runner-groups": "^2.2.0",
67-
"lerna": "^7.3.0",
68-
"lint-staged": "^14.0.1",
69-
"prettier": "^3.0.3",
66+
"lerna": "^7.4.2",
67+
"lint-staged": "^15.1.0",
68+
"prettier": "^3.1.0",
7069
"rimraf": "^5.0.1",
7170
"ts-jest": "^29.1.1",
7271
"ts-node": "^10.9.1",

packages/commons/src/awsSdkUtils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ const customUserAgentMiddleware = (feature: string) => {
4343
return <T extends MiddlewareArgsLike>(next: (arg0: T) => Promise<T>) =>
4444
async (args: T) => {
4545
const powertoolsUserAgent = `PT/${feature}/${PT_VERSION} PTEnv/${EXEC_ENV}`;
46-
args.request.headers[
47-
'user-agent'
48-
] = `${args.request.headers['user-agent']} ${powertoolsUserAgent}`;
46+
args.request.headers['user-agent'] =
47+
`${args.request.headers['user-agent']} ${powertoolsUserAgent}`;
4948

5049
return await next(args);
5150
};

packages/idempotency/tests/e2e/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export const RESOURCE_NAME_PREFIX = 'Idempotency';
22

33
export const ONE_MINUTE = 60 * 1_000;
44
export const TEARDOWN_TIMEOUT = 5 * ONE_MINUTE;
5-
export const SETUP_TIMEOUT = 5 * ONE_MINUTE;
5+
export const SETUP_TIMEOUT = 7 * ONE_MINUTE;
66
export const TEST_CASE_TIMEOUT = 5 * ONE_MINUTE;

packages/logger/src/Logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@ class Logger extends Utility implements LoggerInterface {
639639
item instanceof Error
640640
? { error: item }
641641
: typeof item === 'string'
642-
? { extra: item }
643-
: item;
642+
? { extra: item }
643+
: item;
644644

645645
additionalLogAttributes = merge(additionalLogAttributes, attributes);
646646
});

packages/logger/src/formatter/LogFormatter.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ import type {
77
import type { UnformattedAttributes } from '../types/Logger.js';
88
import { LogItem } from './LogItem.js';
99

10+
/**
11+
* Typeguard to monkey patch Error to add a cause property.
12+
*
13+
* This is needed because the `cause` property is present in ES2022 or newer.
14+
* Since we want to be able to format errors in Node 16.x, we need to
15+
* add this property ourselves. We can remove this once we drop support
16+
* for Node 16.x.
17+
*
18+
* @see https://nodejs.org/api/errors.html#errors_error_cause
19+
*/
20+
const isErrorWithCause = (
21+
error: Error
22+
): error is Error & { cause: unknown } => {
23+
return 'cause' in error;
24+
};
25+
1026
/**
1127
* This class defines and implements common methods for the formatting of log attributes.
1228
*
@@ -49,10 +65,11 @@ abstract class LogFormatter implements LogFormatterInterface {
4965
location: this.getCodeLocation(error.stack),
5066
message: error.message,
5167
stack: error.stack,
52-
cause:
53-
error.cause instanceof Error
68+
cause: isErrorWithCause(error)
69+
? error.cause instanceof Error
5470
? this.formatError(error.cause)
55-
: error.cause,
71+
: error.cause
72+
: undefined,
5673
};
5774
}
5875

packages/logger/tests/e2e/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { randomUUID } from 'node:crypto';
33
const RESOURCE_NAME_PREFIX = 'Logger';
44
const ONE_MINUTE = 60 * 1000;
55
const TEST_CASE_TIMEOUT = ONE_MINUTE;
6-
const SETUP_TIMEOUT = 5 * ONE_MINUTE;
6+
const SETUP_TIMEOUT = 7 * ONE_MINUTE;
77
const TEARDOWN_TIMEOUT = 5 * ONE_MINUTE;
88
const STACK_OUTPUT_LOG_GROUP = 'LogGroupName';
99
const XRAY_TRACE_ID_REGEX = /^1-[0-9a-f]{8}-[0-9a-f]{24}$/;

packages/metrics/tests/e2e/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { MetricUnit } from '../../src/index.js';
44
const RESOURCE_NAME_PREFIX = 'Metrics';
55
const ONE_MINUTE = 60 * 1000;
66
const TEST_CASE_TIMEOUT = 3 * ONE_MINUTE;
7-
const SETUP_TIMEOUT = 5 * ONE_MINUTE;
7+
const SETUP_TIMEOUT = 7 * ONE_MINUTE;
88
const TEARDOWN_TIMEOUT = 5 * ONE_MINUTE;
99

1010
const commonEnvironmentVars = {

0 commit comments

Comments
 (0)