Skip to content

Commit 5475421

Browse files
author
Anthony Bernabeu
authored
Merge pull request #30 from jeremyLabrado/feat/upgrade-nodejs-24-runtime
feat: Upgrade Lambda functions to Node.js 24 runtime
2 parents 0c94057 + 1318620 commit 5475421

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,18 @@ npm run dev
295295

296296
## Requirements
297297

298+
- [Node.js 18+](https://nodejs.org/en/) must be installed on the deployment machine. ([Instructions](https://nodejs.org/en/download/))
298299

299-
- [Node JS 18+](https://nodejs.org/en/) must be installed on the deployment machine. ([Instructions](https://nodejs.org/en/download/))
300+
- [AWS CLI 2+](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) must be installed on the deployment machine. ([Instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html))
300301

301-
- [AWS CLI 2+](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) must be installed on the deployment machine. ([Instructions](https://nodejs.org/en/download/))
302+
## Runtime Versions
303+
304+
The application uses the following AWS Lambda runtimes:
305+
306+
- **Node.js 24.x** - For TypeScript Lambda functions (product summary, recipe steps, authentication)
307+
- **Python 3.12** - For Python Lambda functions (barcode scanning, image analysis, recipe generation)
308+
309+
The Node.js functions were upgraded to Node.js 24 in December 2025 to leverage the latest features including improved HTTP performance (Undici 7), explicit resource management, and enhanced async context handling. See [NODEJS_24_UPGRADE.md](./NODEJS_24_UPGRADE.md) for details.
302310

303311

304312
## Resources

lambda/barcode_product_summary/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ async function getProductSummary(productCode: string, paramsHash: string): Promi
212212
}
213213
}
214214

215-
async function generateSummary(promptText, responseStream) {
215+
async function generateSummary(promptText: string, responseStream: NodeJS.WritableStream) {
216216

217217
const payload = {
218218
messages: [
@@ -270,7 +270,7 @@ async function generateSummary(promptText, responseStream) {
270270
return completion;
271271
}
272272

273-
async function simulateSummaryStreaming(content: string, responseStream): Promise<void> {
273+
async function simulateSummaryStreaming(content: string, responseStream: NodeJS.WritableStream): Promise<void> {
274274

275275
const chunks = [];
276276
let remainingContent = content;
@@ -317,7 +317,7 @@ async function putProductSummaryToDynamoDB(product_code: string, params_hash: st
317317
}
318318
}
319319

320-
async function messageHandler (event, responseStream) {
320+
async function messageHandler (event: APIGatewayProxyEventV2, responseStream: NodeJS.WritableStream) {
321321

322322
try {
323323
logger.info(event as any);

lambda/recipe_step_by_step/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const bedrockRuntimeClient = new BedrockRuntimeClient({ region: process.env.REGI
2929

3030

3131

32-
async function generateRecipeSteps(language: string, recipe, responseStream) {
32+
async function generateRecipeSteps(language: string, recipe: any, responseStream: NodeJS.WritableStream) {
3333

3434
const systemPrompt = "Your task is to generate personalized recipe ideas based on the user's input of available ingredients and dietary preferences. Use this information to suggest a variety of creative and delicious recipes that can be made using the given ingredients while accommodating the user's dietary needs, if any are mentioned. For each recipe, provide a brief description, a list of required ingredients, and a simple set of instructions. Ensure that the recipes are easy to follow, nutritious, and can be prepared with minimal additional ingredients or equipment.";
3535

@@ -155,7 +155,7 @@ async function generateRecipeSteps(language: string, recipe, responseStream) {
155155

156156

157157

158-
async function messageHandler (event, responseStream) {
158+
async function messageHandler (event: APIGatewayProxyEventV2, responseStream: NodeJS.WritableStream) {
159159

160160
try {
161161
logger.info(event as any);

lib/food-analyzer-stack.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export class FoodAnalyzerStack extends Stack {
423423
__dirname,
424424
"../lambda/barcode_product_summary/index.ts"
425425
),
426-
runtime: lambda.Runtime.NODEJS_22_X,
426+
runtime: lambda.Runtime.NODEJS_24_X,
427427
role: basicLambdaRole,
428428
timeout: Duration.minutes(10),
429429
layers: [powerToolsTypeScriptLayer],
@@ -447,7 +447,7 @@ export class FoodAnalyzerStack extends Stack {
447447
"recipeStepByStepFunction",
448448
{
449449
entry: path.join(__dirname, "../lambda/recipe_step_by_step/index.ts"),
450-
runtime: lambda.Runtime.NODEJS_22_X,
450+
runtime: lambda.Runtime.NODEJS_24_X,
451451
role: basicLambdaRole,
452452
timeout: Duration.minutes(10),
453453
layers: [powerToolsTypeScriptLayer],
@@ -543,7 +543,7 @@ export class FoodAnalyzerStack extends Stack {
543543
`AuthFunctionAtEdge`,
544544
{
545545
handler: "index.handler",
546-
runtime: lambda.Runtime.NODEJS_22_X,
546+
runtime: lambda.Runtime.NODEJS_24_X,
547547
code: lambda.Code.fromAsset(path.join(__dirname, "../lambda/auth")),
548548
}
549549
);

0 commit comments

Comments
 (0)