Skip to content

feat(templates): use ImpitHttpClient and install optional deps in Docker#3603

Open
barjin wants to merge 2 commits intomasterfrom
feat/impit-templates-default-client
Open

feat(templates): use ImpitHttpClient and install optional deps in Docker#3603
barjin wants to merge 2 commits intomasterfrom
feat/impit-templates-default-client

Conversation

@barjin
Copy link
Copy Markdown
Member

@barjin barjin commented Apr 24, 2026

Soft-launches Impit as the default HTTP client in all Crawlee templates and removes --omit=optional from the production npm install in the template Dockerfiles so that impit's platform-specific native binaries — shipped via optionalDependencies — actually land in the image.

Closes #3601.

Wires ImpitHttpClient as the default httpClient for every template crawler and drops --omit=optional from the final-stage npm install so impit's platform-specific native binaries (shipped via optionalDependencies) land in the production image. The camoufox-ts template uses the Firefox fingerprint; the others use Chrome. Addresses #3601.
@github-actions github-actions Bot added this to the 139th sprint - Tooling team milestone Apr 24, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Apr 24, 2026
@barjin
Copy link
Copy Markdown
Member Author

barjin commented Apr 24, 2026

Here's the size comparison for different Docker images after dropping --omit-optional from the Dockerfiles.

total_size

For both cheerio and playwright, the difference is basically just impit, the puppeteer image also installs typescript due to a transitive dependency through cosmiconfig.

@barjin barjin requested a review from Copilot April 24, 2026 13:18
@B4nan
Copy link
Copy Markdown
Member

B4nan commented Apr 24, 2026

It will be more important to do this in https://github.com/apify/actor-templates

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR soft-launches Impit as the default HTTP client in Crawlee project templates and updates template Dockerfiles so Impit’s platform-specific native binaries (distributed via optionalDependencies) are installed in production images.

Changes:

  • Inject httpClient: new ImpitHttpClient(...) into crawler instantiations across templates.
  • Add @crawlee/impit-client to template dependencies.
  • Remove --omit=optional from template Dockerfile production installs so optional native binaries are included.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/templates/templates/puppeteer-ts/src/main.ts Configure PuppeteerCrawler to use ImpitHttpClient.
packages/templates/templates/puppeteer-ts/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/puppeteer-ts/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/puppeteer-js/src/main.js Configure PuppeteerCrawler to use ImpitHttpClient.
packages/templates/templates/puppeteer-js/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/puppeteer-js/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/playwright-ts/src/main.ts Configure PlaywrightCrawler to use ImpitHttpClient.
packages/templates/templates/playwright-ts/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/playwright-ts/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/playwright-js/src/main.js Configure PlaywrightCrawler to use ImpitHttpClient.
packages/templates/templates/playwright-js/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/playwright-js/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/getting-started-ts/src/main.ts Configure PlaywrightCrawler to use ImpitHttpClient.
packages/templates/templates/getting-started-ts/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/getting-started-ts/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/getting-started-js/src/main.js Configure PlaywrightCrawler to use ImpitHttpClient.
packages/templates/templates/getting-started-js/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/getting-started-js/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/empty-ts/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/empty-ts/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/empty-js/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/empty-js/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/cheerio-ts/src/main.ts Configure CheerioCrawler to use ImpitHttpClient.
packages/templates/templates/cheerio-ts/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/cheerio-ts/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/cheerio-js/src/main.js Configure CheerioCrawler to use ImpitHttpClient.
packages/templates/templates/cheerio-js/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/cheerio-js/Dockerfile Install prod deps without omitting optionalDependencies.
packages/templates/templates/camoufox-ts/src/main.ts Configure PlaywrightCrawler (Camoufox/Firefox) to use ImpitHttpClient.
packages/templates/templates/camoufox-ts/package.json Add @crawlee/impit-client dependency.
packages/templates/templates/camoufox-ts/Dockerfile Install prod deps without omitting optionalDependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 6 to 9
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0",
"puppeteer": "*"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 9
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0",
"puppeteer": "*"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 9
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0",
"playwright": "1.58.2"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 9
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0",
"playwright": "1.58.2"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 9
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0",
"playwright": "1.58.2"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 9
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0"
},
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"crawlee": "^3.0.0"
},
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Suggested change
},
},
"engines": {
"node": ">=20"
},

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 10
"dependencies": {
"@crawlee/impit-client": "^3.0.0",
"camoufox-js": "^0.9.0",
"crawlee": "^3.0.0",
"playwright": "1.58.2"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).

Copilot uses AI. Check for mistakes.
Comment thread packages/templates/templates/empty-ts/package.json Outdated
Comment thread packages/templates/templates/empty-js/package.json Outdated
…plates

The empty-* templates ship no crawler, so pulling in @crawlee/impit-client and re-enabling optional deps in their Dockerfile has no effect beyond bloating the install. Restore their original state.
@barjin barjin requested review from B4nan and janbuchar April 24, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Consider switching to ImpitHttpClient in Crawlee templates

4 participants