-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Node 22 functions #2269
Allow Node 22 functions #2269
Conversation
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
🦋 Changeset detectedLatest commit: 29ee0db The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I left couple of comments to get checks passing.
@@ -32,7 +32,7 @@ | |||
"uuid": "^9.0.1" | |||
}, | |||
"peerDependencies": { | |||
"aws-cdk-lib": "^2.158.0", | |||
"aws-cdk-lib": "^2.168.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update aws-cdk-lib
and aws-cdk
to matching version in all package.json files across the workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a script update-cdk-in-packages.js
to do this. Sharing in case it is useful to you in the future.
/* eslint-disable */
const rootDir = process.cwd();
import fs from 'fs';
import path from 'path';
async function findPackageJsonFiles(dir) {
let results = [];
const list = fs.readdirSync(dir);
for (let file of list) {
file = path.resolve(dir, file);
const stat = fs.statSync(file);
if (stat && stat.isDirectory()) {
results = results.concat(await findPackageJsonFiles(file));
} else if (file.endsWith('package.json')) {
const relativePath = path.relative(rootDir, file);
if (/packages\/[\w-]+\/package\.json$/.test(relativePath)) {
results.push(file);
}
}
}
return results;
}
function updatePackageVersion(packageJson, packageName, newVersion) {
if (packageJson.dependencies && packageJson.dependencies[packageName]) {
packageJson.dependencies[packageName] = newVersion;
}
if (packageJson.devDependencies && packageJson.devDependencies[packageName]) {
packageJson.devDependencies[packageName] = newVersion;
}
if (packageJson.peerDependencies && packageJson.peerDependencies[packageName]) {
packageJson.peerDependencies[packageName] = newVersion;
}
}
async function updateCdkVersion(filePaths) {
for (let filePath of filePaths) {
const packageJson = JSON.parse(fs.readFileSync(filePath, 'utf8'));
updatePackageVersion(packageJson, 'aws-cdk-lib', '^2.168.0');
updatePackageVersion(packageJson, 'aws-cdk', '^2.168.0');
fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 2) + `\n`, 'utf8');
}
}
async function main() {
const packageJsonFiles = await findPackageJsonFiles(path.join(rootDir, 'packages'));
await updateCdkVersion(packageJsonFiles);
console.log('Updated package.json files:', packageJsonFiles);
}
main();
/* eslint-enable */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you.
there will be one more thing needed - additional changeset, since most of packages got touched.
Please see b56d344 for reference. This commit contains a changeset file from last time we upgraded CDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reference, that helps.
Looks like some tests are failing. Could you please take a look https://github.com/aws-amplify/amplify-backend/actions/runs/12033789933/job/33549492119?pr=2269 ? |
@ataylorme thanks for contributing! |
Thank you! In the spirit of contributing any chance I can get a review of #1971? |
Problem
Closes #2268
Changes
Add support to
@aws-amplify/backend-function
for Node 22, which is a supported Lambda runtime that was added inaws-cdk-lib/aws-lambda
version2.168.0
on November 20th, 2024Validation
Checklist
run-e2e
label set.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.