Skip to content

chore: Update Node, Projen, and Lambda Runtimes#194

Draft
dcousineau wants to merge 2 commits intombonig:mainfrom
dcousineau:dcousineau/update-node-lambda
Draft

chore: Update Node, Projen, and Lambda Runtimes#194
dcousineau wants to merge 2 commits intombonig:mainfrom
dcousineau:dcousineau/update-node-lambda

Conversation

@dcousineau
Copy link
Copy Markdown

@dcousineau dcousineau commented Oct 26, 2024

The primary purpose of this PR was to utilize the NODEJS_LATEST runtime for Lambda introduced in aws/aws-cdk@2aa4733 (v2.93.0). The driving factor is recently AWS dropped support for node@16 as a Lambda runtime, and the NODEJS_LATEST CDK runtime variable points to the current LTS which should remain relatively stable even when it is eventually bumped to node@20.

However NODEJS_LATEST was introduced when the latest supported version was node@18 which required a full upgrade of projen and its related dependencies, as well as dependencies like Typescript.

During the upgrade process it appears that certain manual configurations like the jsii compile tasks that were manually inserted are no longer needed (and in fact break in newer versions of projen), so I commented those lines out and confirmed tests pass.


I will report back on the success of this as I will create another branch and publish my fork to npm to confirm these changes work just fine, specifically the removal of manual build configurations.

EDIT Found the first issue, package.json isn't being provided with the assets

- aws-cdk min version bumped to 2.93.0 preemptively
  - v2.93.0 is first time that NODEJS_LATEST runtime is introduced
  - See: aws/aws-cdk@2aa4733
- Updates related projen dependencies, also updates TypeScript
- Removes now-unnecessary build configuration overrides
- Adds .nvmrc file for local dev
Comment thread .projenrc.js
'eslint',
'esbuild',
],
jsiiVersion: '~5.5.0',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated jsii to latest supported version and using ~5.5.0 to match new projen generated projects.

Comment thread .projenrc.js
Comment on lines +15 to +18
// devDeps: [
// 'eslint',
// 'esbuild',
// ],
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem necessary in newer Projen versions... I can remove for cleanliness, but I am planning on testing a quick publish of my fork first.

Comment thread .projenrc.js
Comment on lines +41 to +46
// project.gitignore.exclude('cdk.context.json', '.cdk.staging/', '.idea/', 'cdk.out/', 'npm-cache/');
// project.npmignore.exclude('cdk.context.json', '.cdk.staging/', '.idea/', 'cdk.out/');

// project.npmignore.include('./lib/handlers/*');

project.compileTask.exec('jsii --silence-warnings=reserved-word --no-fix-peer-dependencies && jsii-docgen && cp src/handlers/*.ts lib/handlers/ && cp src/handlers/cfn-response.js lib/handlers/ && cp -R src/layer lib/layer && cp src/handlers/package* lib/handlers/');
// project.compileTask.exec('cp src/handlers/*.ts lib/handlers/ && cp src/handlers/cfn-response.js lib/handlers/ && cp -R src/layer lib/layer && cp src/handlers/package* lib/handlers/');
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem necessary in newer Projen versions... I can remove for cleanliness, but I am planning on testing a quick publish of my fork first.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the asset bundle's package.json isn't being provided in the packaged outputs, probably an issue here. Poking around!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay couple of other issues, pulling into draft mode now so I can fix them.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to using projen's auto-discovered lambdas should make this special compile task unnecessary and removable.

Comment thread test/DatabaseScript.test.ts
@dcousineau dcousineau changed the title Update Node, Projen, and Lambda Runtimes chore: Update Node, Projen, and Lambda Runtimes Oct 26, 2024
@dcousineau dcousineau marked this pull request as draft October 26, 2024 17:33
@mbonig
Copy link
Copy Markdown
Owner

mbonig commented Oct 27, 2024

Thanks for contributing this. The package was never used heavily so it's definitely grown some weeds and I appreciate the work you're doing to bring it up to date. @me when you're ready for me to review!

@dcousineau
Copy link
Copy Markdown
Author

Of course! I should have something soon. Lot of hidden potholes that have grown up over time. I've got it mostly working right now, now up to runtime issues. Yay!

@mikejgray
Copy link
Copy Markdown

mikejgray commented Jan 9, 2025

@dcousineau Is this close to ready to be reviewed/merged? I'm running into some pain myself with nodejs16 runtimes and would be willing to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants