Skip to content

Commit

Permalink
Allow Node 22 functions (#2269)
Browse files Browse the repository at this point in the history
* Add support to `@aws-amplify/backend-function` for Node 22

Add support to `@aws-amplify/backend-function` for Node 22, which is a [supported Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-deprecation-levels) that was added in [`aws-cdk-lib/aws-lambda` version `2.168.0`](https://github.com/aws/aws-cdk/releases/tag/v2.168.0) on November 20th, 2024

* Regen API docs

* npm clean

* Update aws-cdk-lib and aws-cdk to 2.168.0

* Update aws-cdk-lib and aws-cdk to 2.168.0

* Update test

* Changeset for aws-cdk-lib upgrade

* Update .changeset/forty-bulldogs-end.md

---------

Co-authored-by: Kamil Sobol <sobol.k.r@gmail.com>
  • Loading branch information
ataylorme and sobolk authored Nov 26, 2024
1 parent 0a360fb commit 72b2fe0
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 53 deletions.
8 changes: 8 additions & 0 deletions .changeset/forty-bulldogs-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@aws-amplify/backend-function': minor
'@aws-amplify/backend': minor
---

Add support to `@aws-amplify/backend-function` for Node 22

Add support to `@aws-amplify/backend-function` for Node 22, which is a [supported Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-deprecation-levels) that was added in [`aws-cdk-lib/aws-lambda` version `2.168.0`](https://github.com/aws/aws-cdk/releases/tag/v2.168.0) on November 20th, 2024
20 changes: 20 additions & 0 deletions .changeset/new-rings-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'@aws-amplify/backend-platform-test-stubs': patch
'@aws-amplify/backend-output-storage': patch
'@aws-amplify/integration-tests': patch
'@aws-amplify/backend-deployer': patch
'@aws-amplify/backend-function': patch
'@aws-amplify/schema-generator': patch
'@aws-amplify/backend-storage': patch
'@aws-amplify/auth-construct': patch
'@aws-amplify/ai-constructs': patch
'@aws-amplify/client-config': patch
'@aws-amplify/backend-auth': patch
'@aws-amplify/backend-data': patch
'@aws-amplify/plugin-types': patch
'@aws-amplify/backend-ai': patch
'@aws-amplify/backend': patch
'@aws-amplify/sandbox': patch
---

update aws-cdk lib to ^2.168.0
68 changes: 34 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ai-constructs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"typescript": "^5.0.0"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/auth-construct/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@aws-sdk/util-arn-parser": "^3.568.0"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@aws-amplify/plugin-types": "^1.5.0"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"aws-lambda": "^1.0.7"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@aws-amplify/platform-core": "^1.2.1"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-deployer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"strip-ansi": "^6.0.1"
},
"peerDependencies": {
"aws-cdk": "^2.158.0",
"aws-cdk": "^2.168.0",
"typescript": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend-function/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type FunctionProps = {
export type FunctionSchedule = TimeInterval | CronSchedule;

// @public (undocumented)
export type NodeVersion = 16 | 18 | 20;
export type NodeVersion = 16 | 18 | 20 | 22;

// @public (undocumented)
export type TimeInterval = `every ${number}m` | `every ${number}h` | `every day` | `every week` | `every month` | `every year`;
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"uuid": "^9.0.1"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
6 changes: 3 additions & 3 deletions packages/backend-function/src/factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ void describe('AmplifyFunctionFactory', () => {
void it('sets valid runtime', () => {
const lambda = defineFunction({
entry: './test-assets/default-lambda/handler.ts',
runtime: 16,
runtime: 22,
}).getInstance(getInstanceProps);
const template = Template.fromStack(lambda.stack);

template.hasResourceProperties('AWS::Lambda::Function', {
Runtime: Runtime.NODEJS_16_X.name,
Runtime: Runtime.NODEJS_22_X.name,
});
});

Expand All @@ -335,7 +335,7 @@ void describe('AmplifyFunctionFactory', () => {
entry: './test-assets/default-lambda/handler.ts',
runtime: 14 as NodeVersion,
}).getInstance(getInstanceProps),
new Error('runtime must be one of the following: 16, 18, 20')
new Error('runtime must be one of the following: 16, 18, 20, 22')
);
});

Expand Down
3 changes: 2 additions & 1 deletion packages/backend-function/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,11 @@ const isWholeNumberBetweenInclusive = (
max: number
) => min <= test && test <= max && test % 1 === 0;

export type NodeVersion = 16 | 18 | 20;
export type NodeVersion = 16 | 18 | 20 | 22;

const nodeVersionMap: Record<NodeVersion, Runtime> = {
16: Runtime.NODEJS_16_X,
18: Runtime.NODEJS_18_X,
20: Runtime.NODEJS_20_X,
22: Runtime.NODEJS_22_X,
};
2 changes: 1 addition & 1 deletion packages/backend-output-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@aws-amplify/plugin-types": "^1.3.1"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0"
"aws-cdk-lib": "^2.168.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend-platform-test-stubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "Apache-2.0",
"dependencies": {
"@aws-amplify/plugin-types": "^1.3.1",
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@aws-amplify/platform-core": "^1.2.1"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"lodash.snakecase": "^4.1.1"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 72b2fe0

Please sign in to comment.