Skip to content

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

Open
vdusek wants to merge 6 commits into
v3from
feat/drop-old-node-versions
Open

chore!: require Node.js 22 or newer#984
vdusek wants to merge 6 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].
  • tsconfig.jsonmodule Node16 -> node20, moduleResolution -> nodenext, lib -> ["ES2024", "DOM"], target: "ES2024". ES2024 rather than Crawlee's ESNext, because Node 22 does not implement ES2025 syntax such as using.
  • src/utils.ts — replaced a brotli-availability guard commented as a Node.js < v10.16.0 workaround with a try/catch. The gzip fallback stays, but is now keyed on compression actually failing rather than on the Node version, which also covers runtimes with a partial node:zlib.
  • 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
fail-fast: false
matrix:
node-version: [20, 22, 24]
node-version: [22, 24]

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.

Suggested change
node-version: [22, 24]
node-version: [22, 24, 26]

Comment thread src/utils.ts
}

let gzipPromisified: ((arg: string | Buffer<ArrayBufferLike>) => Promise<Buffer>) | undefined;
let brotliCompressPromisified: ((arg: string | Buffer<ArrayBufferLike>) => Promise<Buffer>) | undefined;

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.

isnt this all unrelated to the nodejs bump?

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