Skip to content

chore!: require Node.js 22 or newer - #984

Merged
B4nan merged 9 commits into
v3from
feat/drop-old-node-versions
Aug 3, 2026
Merged

chore!: require Node.js 22 or newer#984
B4nan merged 9 commits into
v3from
feat/drop-old-node-versions

Conversation

@vdusek

@vdusek vdusek commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Raises the minimum supported Node.js version to 22, matching the Crawlee v4 floor. apify-client sits below @crawlee/core, so its minimum must not be higher than Crawlee's, and there is no reason for it to be lower.

  • package.json — added engines: { "node": ">=22.0.0" }.
  • check.yamlbuild_and_test matrix [20, 22, 24] -> [22, 24, 26], so the client is now also tested against Node.js 26. The remaining jobs stay on 24, as Node.js 26 does not become LTS until October 2026.
  • tsconfig.json — dropped the module: "Node16" and moduleResolution overrides, so the @apify/tsconfig base values (node20/nodenext) apply; lib -> ["ES2024", "DOM"], target: "ES2024". ES2024 rather than Crawlee's ESNext, because Node 22 does not implement ES2025 syntax such as using.
  • Docs — updated docs/01_introduction/index.md and CONTRIBUTING.md. website/versioned_docs/version-2/** is untouched, as it is a frozen v2 snapshot.

Drive-by: pnpm tsc-check-tests was already failing on v3, mostly with TS1541 from the old module: Node16. Nothing ran it in CI, so it went unnoticed; it is fixed and now part of the lint job.

BREAKING CHANGE: Node.js 18 and 20 are no longer supported. The minimum supported version is now Node.js 22.

✍️ Drafted by Claude Code

vdusek added 2 commits July 30, 2026 16:52
Matches the Crawlee v4 floor. `apify-client` sits below `@crawlee/core` in the
dependency graph, so its minimum must not be higher than Crawlee's, and there
is no reason for it to be lower.

- Add `engines.node: ">=22.0.0"`.
- Drop Node 20 from the CI test matrix.
- Move tsc to `NodeNext` module/moduleResolution and an ES2024 target and lib.
- Remove the brotli-availability guard and its gzip fallback, which existed
  only for Node.js < 10.16.0.

BREAKING CHANGE: Node.js 18 and 20 are no longer supported. The minimum
supported version is now Node.js 22.
The script has been failing for a while and is not wired into CI, so the errors
went unnoticed.

- Set `declaration: false` in `test/tsconfig.json`. The project is `noEmit`, but
  it inherited `declaration: true` from `@apify/tsconfig`, so it reported
  declaration-emit portability errors (TS2883 on the express-based mock server,
  TS9005 on the generated browser bundle) for output that is never written.
- Drop the unused `vi` import in `test/utils.test.ts` (TS6133).
- Widen the too-strict `[string]` tuple annotation in `test/runs.test.ts` to
  match vitest's `mock.calls` element type (TS2345).
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 30, 2026
@vdusek vdusek self-assigned this Jul 30, 2026
@vdusek vdusek changed the title feat!: require Node.js 22 or newer chore!: require Node.js 22 or newer Jul 31, 2026
@vdusek
vdusek requested a review from B4nan July 31, 2026 08:45
@vdusek
vdusek marked this pull request as ready for review July 31, 2026 08:45
@vdusek
vdusek requested a review from szaganek as a code owner July 31, 2026 08:45
Comment thread .github/workflows/check.yaml Outdated
Comment thread src/utils.ts Outdated
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✅ The link checker did not find any broken links.

See more at https://github.com/apify/apify-client-js/actions/runs/30806739674#summary-91663747803

@vdusek
vdusek requested a review from B4nan August 3, 2026 10:33
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ There are broken links in the documentation.

See more at https://github.com/apify/apify-client-js/actions/runs/30816883022#summary-91696716786

@B4nan B4nan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

simplifed the tsconfig since it was just mirroring what the base one already set up

@B4nan
B4nan merged commit dd2b97b into v3 Aug 3, 2026
6 checks passed
@B4nan
B4nan deleted the feat/drop-old-node-versions branch August 3, 2026 13:18
vdusek added a commit that referenced this pull request Aug 3, 2026
Request compression guarded brotli availability with a `typeof
brotliCompress === 'function'` check, commented as a workaround for
Node.js < v10.16.0. That version check has been dead code for a long
time, and it does not actually cover the case it was reaching for: a
runtime that exports `brotliCompress` but cannot run it still throws.

Replaced it with a real `try`/`catch` around the compression call,
keeping the gzip fallback. The behavior is now keyed on compression
actually failing rather than on a symbol being present, which also
covers runtimes with a partial `node:zlib` (bundler polyfills, Node
compatibility shims). If gzip fails too, compression is skipped instead
of failing the request, same as before.

Split out of #984 per [this review
discussion](#984 (comment))
- it is unrelated to the Node.js version bump.

*✍️ Drafted by Claude Code*
vdusek added a commit that referenced this pull request Aug 3, 2026
Raises the minimum supported Node.js version to 22, matching the Crawlee
v4 floor. `apify-client` sits below `@crawlee/core`, so its minimum must
not be higher than Crawlee's, and there is no reason for it to be lower.

- **`package.json`** — added `engines: { "node": ">=22.0.0" }`.
- **`check.yaml`** — `build_and_test` matrix `[20, 22, 24]` -> `[22, 24,
26]`, so the client is now also tested against Node.js 26. The remaining
jobs stay on 24, as Node.js 26 does not become LTS until October 2026.
- **`tsconfig.json`** — dropped the `module: "Node16"` and
`moduleResolution` overrides, so the `@apify/tsconfig` base values
(`node20`/`nodenext`) apply; `lib` -> `["ES2024", "DOM"]`, `target:
"ES2024"`. ES2024 rather than Crawlee's `ESNext`, because Node 22 does
not implement ES2025 syntax such as `using`.
- **Docs** — updated `docs/01_introduction/index.md` and
`CONTRIBUTING.md`. `website/versioned_docs/version-2/**` is untouched,
as it is a frozen v2 snapshot.

Drive-by: `pnpm tsc-check-tests` was already failing on `v3`, mostly
with `TS1541` from the old `module: Node16`. Nothing ran it in CI, so it
went unnoticed; it is fixed and now part of the `lint` job.

BREAKING CHANGE: Node.js 18 and 20 are no longer supported. The minimum
supported version is now Node.js 22.

*✍️ Drafted by Claude Code*

---------

Co-authored-by: Martin Adámek <banan23@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants