Node 22 and Azure Functions v4 migration#21
Node 22 and Azure Functions v4 migration#21MarcAstr0 wants to merge 23 commits intoboostercloud:mainfrom
Conversation
There was a problem hiding this comment.
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-azureto use the@azure/functionsv4 SDK (InvocationContextinstead ofContext) androcket-file-uploads-azure-infrastructureto generate v4 function code strings viamountFunctionsV4 - Added vulnerability overrides in root
package.json, added.nvmrc, cleaned uplerna.json, and removedgitHeadentries
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.
...ocket-file-uploads-azure-infrastructure/src/functions/rocket-files-file-uploaded-function.ts
Outdated
Show resolved
Hide resolved
...ocket-file-uploads-azure-infrastructure/src/functions/rocket-files-file-uploaded-function.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
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.
...ocket-file-uploads-azure-infrastructure/src/functions/rocket-files-file-uploaded-function.ts
Outdated
Show resolved
Hide resolved
| 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) | ||
| }) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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
rocket-file-uploads-azure-infrastructurepackage to generate v4-compatible Azure Functionsrocket-file-uploads-azureto work with the v4@azure/functionsSDKpackage.jsonto address several vulnerabilities across dependencies.nvmrcfilelerna.jsonsince Lerna 9 uses configuration inpackage.jsoninstead