Skip to content

fix: add _setupNodeVersion to CDK and E2E test setup functions#3460

Closed
adrianjoshua-strutt wants to merge 1 commit into
aws-amplify:mainfrom
adrianjoshua-strutt:fix/add-setupNodeVersion-to-cdk-tests
Closed

fix: add _setupNodeVersion to CDK and E2E test setup functions#3460
adrianjoshua-strutt wants to merge 1 commit into
aws-amplify:mainfrom
adrianjoshua-strutt:fix/add-setupNodeVersion-to-cdk-tests

Conversation

@adrianjoshua-strutt
Copy link
Copy Markdown
Member

Problem

Data Canary alarms are failling because the CDK canary test steps run on Node.js v18.15.0 instead of the configured v24.12.0.

Root Cause

_setupCDKTestsLinux and _setupE2ETestsLinux in shared-scripts.sh load the .nvm cache from S3 via loadCacheFromBuildJob but never call _setupNodeVersion $AMPLIFY_NODE_VERSION to activate NVM. This means the test phases fall back to the Docker image's system Node (v18.15.0).

When lru-cache v11+ was published to npm. This version uses diagnostics_channel.tracingChannel(), which only exists in Node.js >= 20.5.0. Since the test phases were running Node 18, every canary test crashes with:

TypeError: (0 , R.tracingChannel) is not a function

Every other function in shared-scripts.sh correctly calls _setupNodeVersion:

Only _setupCDKTestsLinux and _setupE2ETestsLinux were missing it.

Testing

The build_linux phase already uses _setupNodeVersion successfully with Node 24.12.0 — this change makes the test phases consistent with it.

…inux

The _setupCDKTestsLinux and _setupE2ETestsLinux functions load the .nvm
cache from S3 but never call _setupNodeVersion to activate it. This causes
the test phases to fall back to the Docker image's system Node (v18.15.0)
instead of using the configured AMPLIFY_NODE_VERSION (v24.12.0).

This became a Sev2 when lru-cache v11+ was published to npm, which requires
Node 20+ (uses diagnostics_channel.tracingChannel()). Since the test phases
were running Node 18, all 83 canary alarms fired across all regions.

Every other function in shared-scripts.sh (_buildLinux, _runGqlE2ETests,
_runCanaryTest, _deploy, etc.) already calls _setupNodeVersion — these two
were the only ones missing it.

Also removes the 'yarn config set ignore-engines true' workaround in
_setupE2ETestsLinux which was masking this same underlying issue.
@adrianjoshua-strutt adrianjoshua-strutt requested a review from a team as a code owner April 6, 2026 15:51
@adrianjoshua-strutt
Copy link
Copy Markdown
Member Author

Closing to push directly to upstream instead of from a fork.

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.

1 participant