chore!: require Node.js 22 or newer - #984
Merged
Merged
Conversation
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).
B4nan
reviewed
Jul 31, 2026
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 |
Contributor
|
See more at https://github.com/apify/apify-client-js/actions/runs/30816883022#summary-91696716786 |
B4nan
approved these changes
Aug 3, 2026
B4nan
left a comment
Member
There was a problem hiding this comment.
simplifed the tsconfig since it was just mirroring what the base one already set up
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raises the minimum supported Node.js version to 22, matching the Crawlee v4 floor.
apify-clientsits 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— addedengines: { "node": ">=22.0.0" }.check.yaml—build_and_testmatrix[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 themodule: "Node16"andmoduleResolutionoverrides, so the@apify/tsconfigbase values (node20/nodenext) apply;lib->["ES2024", "DOM"],target: "ES2024". ES2024 rather than Crawlee'sESNext, because Node 22 does not implement ES2025 syntax such asusing.docs/01_introduction/index.mdandCONTRIBUTING.md.website/versioned_docs/version-2/**is untouched, as it is a frozen v2 snapshot.Drive-by:
pnpm tsc-check-testswas already failing onv3, mostly withTS1541from the oldmodule: Node16. Nothing ran it in CI, so it went unnoticed; it is fixed and now part of thelintjob.BREAKING CHANGE: Node.js 18 and 20 are no longer supported. The minimum supported version is now Node.js 22.
✍️ Drafted by Claude Code