apify/crawlee · error
Cannot detect CDP client for Puppeteer ${parsed.version}. Yo
Error message
Cannot detect CDP client for Puppeteer ${parsed.version}. You should report this to Crawlee, mentioning the puppeteer version you are using. What it means
sendCDPCommand needs a CDP (Chrome DevTools Protocol) client to send raw protocol commands (e.g., for blockRequests). Because Puppeteer's internal API for reaching the CDP client changed across versions, the util probes several known access paths; if none match the installed puppeteer version, it throws this error indicating an unsupported version that should be reported upstream.
Source
Thrown at packages/puppeteer-crawler/src/internals/utils/puppeteer_utils.ts:346
...args: ProtocolMapping.Commands[T]['paramsType']
): Promise<ProtocolMapping.Commands[T]['returnType']> {
// In puppeteer 16.x and 17.x, the `_client` method is completely omitted from the types. It's still there and works the same way, but it is hidden.
// Puppeteer <= 17
if (Reflect.has(page, '_client')) {
const client = Reflect.get(page, '_client');
if (typeof client === 'function') {
return client.call(page).send(command, ...args);
}
return client.send(command, ...args);
}
const jsonPath = require.resolve('puppeteer/package.json');
const parsed = JSON.parse(await readFile(jsonPath, 'utf-8'));
throw new Error(
`Cannot detect CDP client for Puppeteer ${parsed.version}. You should report this to Crawlee, mentioning the puppeteer version you are using.`,
);
}
/**
* `blockResources()` has a high impact on performance in recent versions of Puppeteer.
* Until this resolves, please use `utils.puppeteer.blockRequests()`.
* @deprecated
*/
export const blockResources = async (page: Page, resourceTypes = ['stylesheet', 'font', 'image', 'media']) => {
serviceLocator
.getLogger()
.deprecated(
'utils.puppeteer.blockResources() has a high impact on performance in recent versions of Puppeteer. ' +
'Until this resolves, please use utils.puppeteer.blockRequests()',
);
await addInterceptRequestHandler(page, async (request) => {
const type = request.resourceType();View on GitHub (pinned to dbe57fb09c)
Solutions
- Pin puppeteer to a version within the range supported by your @crawlee/puppeteer-crawler version (check its package.json peerDependencies / devDependencies).
- Update @crawlee/puppeteer-crawler (or crawlee meta-package) to the latest release, which likely adds support for your puppeteer version.
- If it persists on the latest crawlee, file an issue with crawlee including the exact puppeteer version from the error message.
Example fix
// before (package.json)
"dependencies": { "puppeteer": "^24.0.0" }
// after (package.json)
"dependencies": { "puppeteer": "22.12.1" } Defensive patterns
Strategy: fallback
Validate before calling
// check puppeteer compatibility before enabling CDP features
const pkg = require('puppeteer/package.json');
const supported = require('@crawlee/puppeteer-crawler/package.json').devDependencies.puppeteer;
if (!semver.satisfies(pkg.version, supported.replace(/^[\^~]/, ''))) disableCdpFeatures(); Try / catch
try {
await blockRequests(page);
} catch (err) {
if (err.message.includes('Cannot detect CDP client')) {
log.warning('CDP unavailable for this puppeteer version; skipping request blocking');
} else throw err;
} Prevention
- Pin puppeteer to a version matching @crawlee/puppeteer-crawler's tested dependency.
- Upgrade crawlee together with puppeteer, not independently.
- Make CDP-dependent features (blockRequests) optional with a graceful fallback.
When it happens
Trigger: Calling blockRequests() (which uses sendCDPCommand) against an installed puppeteer version whose internal structure matches none of the supported access patterns — typically a newly released major/minor puppeteer version not yet handled by the current crawlee.
Common situations: npm/pnpm update pulled a puppeteer version ahead of crawlee's tested range; lockfile drift in CI; using puppeteer (not puppeteer-core) versions before/after the windows crawlee supports.
Related errors
- PuppeteerCrawlerOptions.launchContext.proxyUrl is not allowe
- Intercept request handler must call one of request.continue|
- Function `newBrowserCDPSession()` is not available in incogn
- A new page can be created with provided context only when us
- Experimental containers are only available with Playwright
AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30).
Data as JSON: /api/errors/ff7f2f357a84eeed.
Report an issue: GitHub.