Skip to content

chore!: require Node.js 22 or later - #189

Open
MLawlz wants to merge 3 commits into
mainfrom
mlawler/require-node-22
Open

MLawlz wants to merge 3 commits into
mainfrom
mlawler/require-node-22

Conversation

@MLawlz

@MLawlz MLawlz commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Raises the minimum Node.js version from 18 to 22 and bumps the SDK to 5.0.0. Node.js 18 reached end of life in April 2025 and Node.js 20 in April 2026, so 22 is the oldest release line still getting security fixes. There are no runtime changes; this release only changes which Node versions are supported and tested.

Changes

  • package.json: engines.node >=18 → >=22, version 4.42.0 → 5.0.0, and @types/node ^18 → ^22 (with pnpm-lock.yaml), so the SDK is type-checked against the oldest Node it supports
  • CHANGELOG.md: [5.0.0] entry, marked Breaking
  • test.yml: matrix 18, 20 → 22, 24
  • publish.yml, api-reference.yml, version-bump.yml: Node 20 → 24. This is required for the first two: pnpm refuses to install a project whose own engines doesn't match the running Node, so releases would fail on 20.
  • docs/compat.md, CLAUDE.md: now say 22+; compat.md points Node 18/20 users to v4
  • README.md: the Quickstart says Node.js 22+ is required and how to stay on v4 (npm install assemblyai@4). npm on Node 18/20 only warns (EBADENGINE) and installs 5.x anyway.
  • src/utils/live.ts: two comments justified a choice by Node 18 or 20; they now give the reason that still holds. The code is unchanged: Math.random is enough for a multipart boundary and needs no polyfill on React Native, and replacing the hand-rolled deadlineSignal with AbortSignal.any would raise the minimum browsers to Chrome 116 and Safari 17.4.
  • tests/unit/utils.test.ts: three user-agent assertions, explained below

Why the user-agent tests changed

They would have failed on the new matrix. Node 21 added a global navigator.userAgent ("Node.js/22"). buildUserAgent uses it as the User-Agent prefix and deliberately skips runtime_env=Node/<version> when that string already names Node. CI only ever ran 18 and 20, so the tests expected runtime_env. They now assert the Node.js/<major> prefix. SDK behavior is unchanged.

Worth knowing: requests from Node 21+ already send only the Node major version and no runtime_env, so anything that reads runtime_env from the User-Agent for analytics is missing those users today.

Why a major version

Yarn 1 enforces dependency engines by default, as do npm and pnpm with engine-strict. Released as 4.x, this would break installs for anyone on Node 18/20 with a ^4 range.

Testing

  • CI passes on Node 22 and 24 (build, lint, unit tests).
  • Locally on Node 26.12.1, from a clean install with pnpm 8.10.0 (the version CI uses): build, eslint, tsc, prettier and publint pass, and unit tests pass 551/551 with ts-jest type-checking on.
  • Integration tests weren't run.

Notes

🤖 Generated with Claude Code

MLawlz and others added 3 commits September 24, 2026 14:27
Node.js 18 and 20 have reached end of life, so raise engines.node to
>=22, test on 22 and 24, and bump to 5.0.0. The publish and API
reference workflows move to Node 24 as well, since pnpm refuses to
install a project whose own engines field doesn't match the running
Node.

The user-agent tests expected runtime_env=Node/<version>, which the SDK
only adds when navigator.userAgent doesn't already name Node. Node 21+
defines navigator.userAgent ("Node.js/22"), so the tests now assert
that prefix instead. SDK behavior is unchanged.

BREAKING CHANGE: Node.js 18 and 20 are no longer supported.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Resolve conflicts with 4.41.5–4.42.0: keep the 5.0.0 version with main's
text-to-speech package description, and put the 5.0.0 changelog entry
above main's new entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raise @types/node from ^18 to ^22, so the SDK is type-checked against
the oldest Node it now supports. Two comments in src/utils/live.ts
justified a choice by Node 18 or 20; they now give the reason that
still holds. The README quickstart says which Node versions 5.x needs
and how to stay on 4.x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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