Impit Native Binary (Linux x64 GNU)
Impit is a low-level, high-performance HTTP client designed for advanced web scraping and automation tasks that require sophisticated anti-bot evasion. It achieves this by emulating various browser and HTTP client fingerprints, including popular Chrome versions, OkHTTP, and custom HTTP/2 SETTINGS, to make requests appear as legitimate traffic. The current stable JavaScript version is 0.13.0, with a release cadence of new features and bug fixes every few weeks to months. This particular package, `impit-linux-x64-gnu`, provides the specific x64 Linux binary component for the main `@apify/impit` JavaScript library, which handles the orchestration and API. Its key differentiators include native performance via Rust bindings and granular control over network parameters like headers, redirects, and cookies, enabling highly customizable and stealthy web interactions.
Common errors
-
Error: Cannot find module '@apify/impit/binary_name_for_your_platform' or similar native module loading error.
cause The `@apify/impit` package failed to locate or load the correct platform-specific binary (like `impit-linux-x64-gnu`). This often happens if the `postinstall` script failed, or if the `optionalDependencies` for the binary were not correctly resolved for your system.fixTry reinstalling the main package: `npm rebuild @apify/impit` or `npm install --force @apify/impit`. Ensure your system has `node-gyp` dependencies if building from source. For deployment, ensure the correct binary for your target platform is present or built. -
Error: Request timed out after Xms.
cause The HTTP request initiated by Impit did not receive a response within the configured timeout period. This could be due to slow network, server unresponsiveness, or target website deliberately delaying responses for bot detection.fixIncrease the `timeout` option in the `Impit` constructor or `fetch` call (e.g., `timeout: 60_000` for 60 seconds). Inspect the target website's behavior and consider implementing retry logic with exponential backoff. Ensure your proxy (if used) is responsive. -
Error: ETIMEDOUT (Connection timed out) or ECONNREFUSED (Connection refused)
cause Indicates a network-level issue where Impit couldn't establish or maintain a connection to the target server or proxy. This might be a firewall issue, incorrect proxy configuration, or the target server being offline/unreachable.fixVerify network connectivity from the machine running Impit to the target. Double-check `proxyUrl` configuration for typos or incorrect credentials. Ensure any firewalls or security groups allow outbound connections on the necessary ports. -
Error: certificate verify failed
cause The TLS/SSL certificate of the target server could not be verified, often encountered when using proxies that re-encrypt traffic, or when dealing with self-signed certificates. This results from untrusted certificates in the chain.fixFor development or trusted environments (use with caution in production), you might need to disable TLS verification by setting a specific option in Impit, if available, or configuring the underlying `NODE_TLS_REJECT_UNAUTHORIZED='0'` (discouraged). The correct fix usually involves correctly configuring your proxy's CA certificates or adding the custom CA to your system's trust store.
Warnings
- breaking In version `0.9.1`, the internal handling of redirects and cookies shifted from Rust to JavaScript. While intended to fix high-concurrency segmentation faults, this fundamental change in core request processing might introduce subtle behavioral differences or new edge cases for complex scraping scenarios compared to previous versions. Users relying on very specific redirect or cookie behavior should re-verify functionality.
- gotcha As a native Node.js module built with `napi-rs`, Impit's stability can occasionally be affected by memory management issues, particularly in high-concurrency environments or when interacting with Node.js `Buffer` objects. While versions `0.9.0` and `0.10.0` included fixes for double-free errors and AbortSignal listener leaks, developers should monitor memory usage and potential segmentation faults in stress tests.
- gotcha The effectiveness of 'fingerprinting' and 'impersonation' relies on keeping the emulated browser/client profiles up-to-date with real-world browser behavior. As websites evolve their bot detection, Impit's built-in fingerprints might become stale, leading to increased detection and blocking. This requires continuous maintenance from the library developers and awareness from users.
- gotcha Native Node.js modules, including `impit-linux-x64-gnu`, can sometimes fail to install or load correctly due to missing system dependencies (like C/C++ build tools) or ABI incompatibilities between Node.js versions. This typically manifests as 'Cannot find module' or 'Failed to load native module' errors.
Install
-
npm install impit-linux-x64-gnu -
yarn add impit-linux-x64-gnu -
pnpm add impit-linux-x64-gnu
Imports
- Impit
const Impit = require('@apify/impit');import { Impit } from '@apify/impit'; - ImpitOptions
import { Impit, type ImpitOptions } from '@apify/impit'; - RequestInit
import { Impit, type RequestInit } from '@apify/impit';
Quickstart
import { Impit } from '@apify/impit';
async function fetchData() {
const impit = new Impit({
client: 'chrome_100', // Emulate Chrome 100 fingerprint
// Other common options include:
// proxyUrl: process.env.PROXY_URL ?? 'http://user:pass@proxy.example.com:8000',
// followRedirects: true,
// timeout: 30_000, // 30 seconds
});
try {
console.log('Fetching data with Impit...');
const response = await impit.fetch('https://httpbin.org/get', {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9'
},
// Per-request options, e.g., to override instance-level redirect setting
redirect: 'manual', // or 'follow', 'error'
timeout: 10_000, // Per-request timeout of 10 seconds
});
if (response.ok) {
const data = await response.json();
console.log('Successfully fetched data:', data);
} else {
console.error(`Request failed with status: ${response.status} - ${response.statusText}`);
const errorBody = await response.text();
console.error('Response body:', errorBody);
}
} catch (error) {
console.error('An error occurred during fetch:', error);
}
}
fetchData();