Skip to content

fix(cloud-assembly-schema): validation crashes with Invalid URL on Node >= 24.20.0 - #1945

Merged
aws-cdk-automation merged 2 commits into
mainfrom
mrgrain/fix/cloud-assembly-schema/jsonschema-invalid-url
Sep 4, 2026
Merged

fix(cloud-assembly-schema): validation crashes with Invalid URL on Node >= 24.20.0#1945
aws-cdk-automation merged 2 commits into
mainfrom
mrgrain/fix/cloud-assembly-schema/jsonschema-invalid-url

Conversation

@mrgrain

@mrgrain mrgrain commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Since GitHub runners started rolling out Node.js 24.20.0 (via node-version: lts/*), builds have been failing intermittently in @aws-cdk/cloud-assembly-schema with TypeError: Invalid URL during schema validation. The failure appears intermittent because it depends on which Node version the runner has cached; it will become permanent as the rollout completes.

The root cause is a latent bug in jsonschema@1.5.0 (the latest release). When no base option is passed to validate(), it stringifies undefined into its internal base URI, producing ref URIs like /undefined#/definitions/X. It then re-parses these against the opaque base thismessage::/, which is invalid per the WHATWG URL spec. Older URL parsers tolerated this; the Ada 4.0.0 parser shipped in Node.js 24.20.0 correctly rejects it, so every manifest validation throws. Our schemas and refs are standard and not at fault.

Since no fixed jsonschema release exists, this applies the upstream fix from tdegrunt/jsonschema#424 via yarn patch: it splits the # fragment manually instead of round-tripping through new URL(). The resolution is scoped to the jsonschema dependency of @aws-cdk/cloud-assembly-schema and declared in .projenrc.ts, because yarn only reads resolutions from the monorepo root. Note that jsonschema is a bundled dependency, so the patched code ships in the published package. The patch should be removed once upstream releases a fix.

Verified by running the full @aws-cdk/cloud-assembly-schema test suite (38 passed) and by exercising manifest loading with a simulated strict URL parser that throws like Node 24.20.0 does.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…L on Node >= 24.20.0

jsonschema@1.5.0 builds invalid URLs when resolving local $refs and
re-parses them against an opaque base. The Ada 4.0.0 URL parser in
Node.js >= 24.20.0 rejects this with "TypeError: Invalid URL", breaking
every manifest validation.

Apply the upstream fix (tdegrunt/jsonschema#424) via yarn patch, scoped
to the jsonschema dependency of @aws-cdk/cloud-assembly-schema.
@mrgrain
mrgrain deployed to automation September 4, 2026 12:52 — with GitHub Actions Active
@mrgrain
mrgrain deployed to automation September 4, 2026 12:52 — with GitHub Actions Active
@github-actions github-actions Bot added the p2 label Sep 4, 2026
@mrgrain
mrgrain deployed to no-approval September 4, 2026 12:52 — with GitHub Actions Active
@aws-cdk-automation
aws-cdk-automation requested a review from a team September 4, 2026 12:52
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@ShadowCat567 ShadowCat567 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not like this because we have to remember that we did this when jsonschema is fixed but we need this fix sooner than jsonschema is going to roll it out :/

@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 9aaa34e Sep 4, 2026
41 checks passed
@aws-cdk-automation
aws-cdk-automation deleted the mrgrain/fix/cloud-assembly-schema/jsonschema-invalid-url branch September 4, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants