Skip to content

Instantly share code, notes, and snippets.

@vitalygashkov
Last active February 28, 2026 09:57
Show Gist options
  • Select an option

  • Save vitalygashkov/b7d569726adaeebc58abf0ef4d54e8c6 to your computer and use it in GitHub Desktop.

Select an option

Save vitalygashkov/b7d569726adaeebc58abf0ef4d54e8c6 to your computer and use it in GitHub Desktop.
Repro for impit error "SelectedUnusableCipherSuiteForVersion"
import { fetch as undiciFetch } from 'undici';
import { Impit } from 'impit';
const url = 'https://api.ivi.ru/mobileapi/user/register/storageless/v5/';
const method = 'POST';
console.log(`Node: ${process.version}`);
console.log(`Platform: ${process.platform} ${process.arch}`);
console.log(`URL: ${url}`);
console.log(`Method: ${method}`);
console.log('');
(async () => {
await runRequest('impit', () => new Impit({ browser: 'chrome' }).fetch(url, { method }));
await runRequest('undici', () => undiciFetch(url, { method }));
await runRequest('native', () => fetch(url, { method }));
})().catch((error) => {
console.error(error);
process.exit(1);
});
async function runRequest(name, fn) {
try {
const response = await fn();
const body = (await response.text()).slice(0, 160);
console.log(`[${name}] OK`);
console.log(` status: ${response.status}`);
console.log(` body: ${JSON.stringify(body)}`);
} catch (error) {
console.log(`[${name}] FAIL`);
const err = error ?? {};
const message = err instanceof Error ? err.message : String(err);
const code = typeof err === 'object' && err !== null && 'code' in err ? String(err.code) : '';
console.log(` error: ${message}`);
if (code) console.log(` code: ${code}`);
}
}
// Output:
/*
Node: v24.3.0
Platform: darwin arm64
URL: https://api.ivi.ru/mobileapi/user/register/storageless/v5/
Method: POST
[impit] FAIL
error: impit error: Failed to connect to the server.
Reason: hyper_util::client::legacy::Error(
Connect,
Custom {
kind: Other,
error: Custom {
kind: InvalidData,
error: PeerMisbehaved(
SelectedUnusableCipherSuiteForVersion,
),
},
},
)
code: GenericFailure
[undici] OK
status: 200
body: "{\"result\":{\"session\":\"78acba288534223839043909_1788083530-0fN0SOLkSg50Gg7aWi9egww\"}}"
[native] OK
status: 200
body: "{\"result\":{\"session\":\"f2761d368534223840282416_1788083530-0t1iX5yqowSyUEpK_MsWUow\"}}"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment