Skip to content

Node 22 and Azure Functions v4 migration#21

Open
MarcAstr0 wants to merge 23 commits intoboostercloud:mainfrom
Optum:node_22
Open

Node 22 and Azure Functions v4 migration#21
MarcAstr0 wants to merge 23 commits intoboostercloud:mainfrom
Optum:node_22

Conversation

@MarcAstr0
Copy link
Collaborator

@MarcAstr0 MarcAstr0 commented Mar 6, 2026

Description

This PR adds Node 22 support to the File Uploads Rocket. The changes in this PR are similar to those introduced in #1593 of the framework. This PR also addresses several vulnerabilities found in the dependencies.

This version of the rocket is compatible with 4.x versions of the main framework.

Changes

  • Updated rocket-file-uploads-azure-infrastructure package to generate v4-compatible Azure Functions
  • Updated rocket-file-uploads-azure to work with the v4 @azure/functions SDK
  • Added overrides to package.json to address several vulnerabilities across dependencies
  • Added .nvmrc file
  • Modified lerna.json since Lerna 9 uses configuration in package.json instead
  • Added test configs compatible with Node 22
  • Updated dependencies across all packages to support Node 22

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the Booster File Uploads Rocket from Node 20 / Azure Functions v3 programming model to Node 22 / Azure Functions v4 programming model, aligning it with the Booster framework v4.x release. The infrastructure code now generates v4-compatible function definitions as JavaScript code strings, and the runtime code uses InvocationContext.triggerMetadata instead of the v3 Context.bindingData.

Changes:

  • Updated all packages to use @boostercloud/framework-* v4.0.0 peer/dev dependencies, along with Node 22 type definitions and test tooling updates
  • Migrated rocket-file-uploads-azure to use the @azure/functions v4 SDK (InvocationContext instead of Context) and rocket-file-uploads-azure-infrastructure to generate v4 function code strings via mountFunctionsV4
  • Added vulnerability overrides in root package.json, added .nvmrc, cleaned up lerna.json, and removed gitHead entries

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.nvmrc Added Node version file pointing to lts/jod (Node 22)
package.json Updated lerna, metadata-booster versions; added vulnerability overrides; updated clean-compile script
lerna.json Removed legacy command.add and command.bootstrap configuration
packages/rocket-file-uploads-azure/src/file-uploaded.ts Migrated from v3 Context.bindingData to v4 InvocationContext.triggerMetadata
packages/rocket-file-uploads-azure/test/file-uploaded.test.ts Updated tests to use v4 triggerMetadata format with { blob, context } request shape
packages/rocket-file-uploads-azure/package.json Updated @azure/functions to v4, Node 22 types, framework v4 deps
packages/rocket-file-uploads-azure/.mocharc.yml Added no-experimental-strip-types node option for Node 22
packages/rocket-file-uploads-azure-infrastructure/src/index.ts Replaced mountFunctions with mountFunctionsV4; fixed bind target from Synth to Functions
packages/rocket-file-uploads-azure-infrastructure/src/functions/functions.ts Rewrote to generate v4 function code strings via FunctionAppV4Definitions
packages/rocket-file-uploads-azure-infrastructure/src/functions/rocket-files-file-uploaded-function.ts Replaced JSON-based function definition with generated JavaScript code template
packages/rocket-file-uploads-azure-infrastructure/src/synth/terraform-function-app.ts Updated node version to ~22, removed outdated v3 comment
packages/rocket-file-uploads-azure-infrastructure/package.json Updated cdktf, azurerm provider, Node 22 types, framework v4 deps
packages/rocket-file-uploads-types/package.json Updated framework v4 deps, minimatch, mocha, Node 22 types
packages/rocket-file-uploads-types/.mocharc.yml Added no-experimental-strip-types node option for Node 22
packages/rocket-file-uploads-core/package.json Updated framework v4 deps
packages/rocket-file-uploads-local/package.json Updated framework v4 deps
packages/rocket-file-uploads-local-infrastructure/package.json Updated framework v4 deps, azurerm provider

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 148 to 163
describe('getMetadataFromRequest', () => {
it('extracts bindingData from Azure Functions context', () => {
const mockContext = {
bindingData: {
blobTrigger: 'test-container/test-path/file.txt',
invocationId: 'test-id',
},
it('extracts triggerMetadata from Azure Functions v4 InvocationContext', () => {
const mockRequest = {
blob: Buffer.from('test content'),
context: {
triggerMetadata: {
blobTrigger: 'test-container/test-path/file.txt',
invocationId: 'test-id',
}
}
}

const result = getMetadataFromRequest(mockContext)
const result = getMetadataFromRequest(mockRequest)

expect(result).to.deep.equal(mockContext.bindingData)
expect(result).to.deep.equal(mockRequest.context.triggerMetadata)
})
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

The getMetadataFromRequest function now has error handling for missing context or triggerMetadata (lines 9-11 in file-uploaded.ts), but the test suite only covers the happy path. Consider adding tests for error cases, such as when context is missing or when triggerMetadata is null/undefined, to verify the descriptive error is thrown.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants