injecting firefox fingerprint with headers into puppeteer will crash puppeteer
Closed this issue · 1 comments
Describe the bug
Since version 2.1.16 when using attachFingerprintToPuppeteer
all headers generated are added to the page object using setExtraHTTPHeaders
, this causes puppeteer to crash when generating fingerprint and headers for firefox and injecting them into puppeteer.
The header in question causing the crash is te
which is currently unsupported by chromium:
https://github.com/chromium/chromium/blob/8abfec7efff916f7056a14632cc66c42ff7c24cd/services/network/public/cpp/header_util.cc#L42
To Reproduce
const browserFingerprintWithHeaders = fingerprintGenerator.getFingerprint({
devices: ["desktop"],
operatingSystems: ["macos"],
browsers: ["firefox"],
});
const fingerprintInjector = new FingerprintInjector();
await fingerprintInjector.attachFingerprintToPuppeteer(page, browserFingerprintWithHeaders);
This will generate the following error:
Error: net::ERR_INVALID_ARGUMENT at https://www.example.com
at navigate (.../node_modules/puppeteer-core/src/common/Frame.ts:362:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Frame.goto (.../node_modules/puppeteer-core/src/common/Frame.ts:315:17)
at async CDPPage.goto (.../node_modules/puppeteer-core/src/common/Page.ts:909:12)
at async .../workspaces/autocite-worker/src/puppeteer.ts:35:24
Expected behavior
Any headers that puppeteer does not support should not be added with setExtraHTTPHeaders
System information:
- Node.js version 18.15.0
- fingerprint-suite 2.1.17
- puppeteer 19.9.0
Additional context
Skipping the te
header solved the issue for us:
// skip te header as it was crashing puppeteer
const { te, ...headers } = browserFingerprintWithHeaders.headers;
const fingerprintInjector = new FingerprintInjector();
await fingerprintInjector.attachFingerprintToPuppeteer(page, {
fingerprint: browserFingerprintWithHeaders.fingerprint,
headers,
});
Thank you for submitting this issue! (...and sorry we took a bit longer, I was afk this week).
Indeed, in 2.1.16
we changed how the injected HTTP headers are processed in browsers. This has caused a few issues, including the one you have encountered. I just released a new version v2.1.19
, which should fix this problem. If you are still using fingerprint-suite in your stack, feel free to check it out and tell us, whether this fixed your problem.
Last things last - while we fully support Puppeteer, I discovered that the Playwright-controlled instances tend to perform slightly better in detection benchmarks. The APIs of those libraries are pretty much the same, so there is virtually no migration cost.
Either way, thanks again for bringing this up! I'll close this issue as solved now, but feel free to reopen it if you find another problem :)