sumithemmadi / truecallerjs

TruecallerJS: This is a library for retrieving phone number details using the Truecaller API.
http://truecaller.js.org/
MIT License
471 stars 100 forks source link

AxiosError: Request failed with status code 426 #32

Open PalmerMontalvo opened 1 year ago

PalmerMontalvo commented 1 year ago

All of truecallerjs.search() requests returns with error "AxiosError: Request failed with status code 426" and data: { status: 42601, message: 'Client must be upgraded' }

RabbitFored commented 1 year ago

I too face the same issue.

I think this issue is similar to #23

RabbitFored commented 1 year ago

I get this error: https://paste.theostrich.eu.org/xepepitipu

`AxiosError: Request failed with status code 426 at settle (/home/runner/truecaller-test-limitations/node_modules/axios/dist/node/axios.cjs:1909:12) at Unzip.handleStreamEnd (/home/runner/truecaller-test-limitations/node_modules/axios/dist/node/axios.cjs:2989:11) at Unzip.emit (node:events:525:35) at Unzip.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1359:12) { code: 'ERR_BAD_REQUEST', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: [class Blob] }, validateStatus: [Function: validateStatus], headers: AxiosHeaders { Accept: 'application/json, text/plain, /', 'content-type': 'application/json; charset=UTF-8', 'accept-encoding': 'gzip', 'user-agent': 'Truecaller/11.75.5 (Android;10)', Authorization: 'Bearer a1i0xxxxxxxxstMb8' }, params: { q: '9912345678', countryCode: 'IN', type: 4, locAddr: '', placement: 'SEARCHRESULTS,HISTORY,DETAILS', encoding: 'json' }, method: 'get', url: 'https://search5-noneu.truecaller.com/v2/search', data: undefined }, request: <ref 1> ClientRequest { _events: [Object: null prototype] { abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], finish: [Function: requestOnFinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'search5-noneu.truecaller.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 9, connecting: false, _hadError: false, _parent: null, _host: 'search5-noneu.truecaller.com', _closeAfterHandlingError: false, _readableState: [ReadableState], _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: null, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular 1],

  [Symbol(verified)]: true,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: 14,
  [Symbol(kHandle)]: null,
  [Symbol(lastWriteQueueSize)]: 0,
  [Symbol(timeout)]: null,
  [Symbol(kBuffer)]: null,
  [Symbol(kBufferCb)]: null,
  [Symbol(kBufferGen)]: null,
  [Symbol(kCapture)]: false,
  [Symbol(kSetNoDelay)]: false,
  [Symbol(kSetKeepAlive)]: true,
  [Symbol(kSetKeepAliveInitialDelay)]: 60,
  [Symbol(kBytesRead)]: 658,
  [Symbol(kBytesWritten)]: 426,
  [Symbol(connect-options)]: [Object]
},
_header: 'GET /v2/search?q=9912345678&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS,HISTORY,DETAILS&encoding=json HTTP/1.1\r\n' +
  'Accept: application/json, text/plain, */*\r\n' +
  'content-type: application/json; charset=UTF-8\r\n' +
  'accept-encoding: gzip\r\n' +
  'user-agent: Truecaller/11.75.5 (Android;10)\r\n' +
  'Authorization: Bearer a1i0MxxxxxxxxxxxxxxxxxxL6rstMb8\r\n' +
  'Host: search5-noneu.truecaller.com\r\n' +
  'Connection: close\r\n' +
  '\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
  _events: [Object: null prototype],
  _eventsCount: 2,
  _maxListeners: undefined,
  defaultPort: 443,
  protocol: 'https:',
  options: [Object: null prototype],
  requests: [Object: null prototype] {},
  sockets: [Object: null prototype] {},
  freeSockets: [Object: null prototype] {},
  keepAliveMsecs: 1000,
  keepAlive: false,
  maxSockets: Infinity,
  maxFreeSockets: 256,
  scheduling: 'lifo',
  maxTotalSockets: Infinity,
  totalSocketCount: 0,
  maxCachedSessions: 100,
  _sessionCache: [Object],
  [Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/v2/search?q=9912345678&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS,HISTORY,DETAILS&encoding=json',
_ended: true,
res: IncomingMessage {
  _readableState: [ReadableState],
  _events: [Object: null prototype],
  _eventsCount: 4,
  _maxListeners: undefined,
  socket: [TLSSocket],
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  httpVersion: '1.1',
  complete: true,
  rawHeaders: [Array],
  rawTrailers: [],
  aborted: false,
  upgrade: false,
  url: '',
  method: null,
  statusCode: 426,
  statusMessage: 'unknown',
  client: [TLSSocket],
  _consuming: true,
  _dumped: false,
  req: [Circular *1],
  responseUrl: 'https://search5-noneu.truecaller.com/v2/search?q=9912345678&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS,HISTORY,DETAILS&encoding=json',
  redirects: [],
  [Symbol(kCapture)]: false,
  [Symbol(kHeaders)]: [Object],
  [Symbol(kHeadersCount)]: 22,
  [Symbol(kTrailers)]: null,
  [Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'search5-noneu.truecaller.com',
protocol: 'https:',
_redirectable: Writable {
  _writableState: [WritableState],
  _events: [Object: null prototype],
  _eventsCount: 3,
  _maxListeners: undefined,
  _options: [Object],
  _ended: true,
  _ending: true,
  _redirectCount: 0,
  _redirects: [],
  _requestBodyLength: 0,
  _requestBodyBuffers: [],
  _onNativeResponse: [Function (anonymous)],
  _currentRequest: [Circular *1],
  _currentUrl: 'https://search5-noneu.truecaller.com/v2/search?q=9912345678&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS,HISTORY,DETAILS&encoding=json',
  [Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kEndCalled)]: true,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
  accept: [Array],
  'content-type': [Array],
  'accept-encoding': [Array],
  'user-agent': [Array],
  authorization: [Array],
  host: [Array]
},
[Symbol(kUniqueHeaders)]: null

}, response: { status: 426, statusText: 'unknown', headers: AxiosHeaders { vary: 'Accept-Encoding', 'tc-event-id': '64afa10e85133f0001f4156e', date: 'Thu, 13 Jul 2023 07:00:30 GMT', 'content-type': 'application/json', 'x-envoy-upstream-service-time': '3', server: 'istio-envoy', via: '1.1 google', 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', connection: 'close', 'transfer-encoding': 'chunked' }, config: { transitional: [Object], adapter: [Array], transformRequest: [Array], transformResponse: [Array], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: [Object], validateStatus: [Function: validateStatus], headers: [AxiosHeaders], params: [Object], method: 'get', url: 'https://search5-noneu.truecaller.com/v2/search', data: undefined }, request: <ref 1> ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: true, socket: [TLSSocket], _header: 'GET /v2/search?q=9912345678&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS,HISTORY,DETAILS&encoding=json HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /*\r\n' + 'content-type: application/json; charset=UTF-8\r\n' + 'accept-encoding: gzip\r\n' + 'user-agent: Truecaller/11.75.5 (Android;10)\r\n' + 'Authorization: Bearer a1i0M--xxxxxxxxxxxxxxxxxxxx7L6rstMb8\r\n' + 'Host: search5-noneu.truecaller.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/v2/search?q=9912345678&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS,HISTORY,DETAILS&encoding=json', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'search5-noneu.truecaller.com', protocol: 'https:', _redirectable: [Writable],

  [Symbol(kBytesWritten)]: 0,
  [Symbol(kEndCalled)]: true,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(kUniqueHeaders)]: null
},
data: { status: 42601, message: 'Client must be upgraded' }

} }`

RabbitFored commented 1 year ago

MY CODE:

import { createRequire } from 'module';
const require = createRequire(import.meta.url);
var truecallerjs = require("truecallerjs");

var search_data = {
  number: "9912345678",
  countryCode: "IN",
  installationId: "a1i0xxxxxxxxxxxxxxxxxxxtMb8",
};

var response = await truecallerjs.search(search_data);
console.log(response.json());
RabbitFored commented 1 year ago

UPDATE:

When I try it with your python module truecallerpy it gives differerent output as:

{'errorCode': 401, 'errorMessage': 'Your previous login was expired.', 'data': None}

when I tried with new installation ID it worked fine

Any idea on why these two modules show different output?

And also I tested truecallerjs with expired installation ID, it gives Unauthorized 403 as usual. But code 426 is unusual

RabbitFored commented 1 year ago

wait what https://github.com/sumithemmadi/truecallerpy/blob/7749987f99374262b777bbf9b86097dcdb8c67b1/truecallerpy/app.py#L117 👀

same error in truecallerpy too after removing that lines {'status': 42601, 'message': 'Client must be upgraded'}

even curl return same response:

curl -A "Truecaller/12.15.6 (Android;10)" -H authorization:\ Bearer\ a1i0I--gxxxxxxxxxxxxxxxxxxsjtHSf https://search5-noneu.truecaller.com/v2/search?q=1234567890\&countryCode=IN\&type=4\&encoding=json

{'status': 42601, 'message': 'Client must be upgraded'}

Is there any validity period for installationIDs? And I tried to login with same phone number and got new installationID that too didnt work, got same response

PalmerMontalvo commented 1 year ago

@RabbitFored I just took a brand new phone number that I had never used before and this error did not occur. Most likely, the numbers are also checked for the amount of uses

RabbitFored commented 1 year ago

@PalmerMontalvo Your old phone number still don't work 2 days after this? https://github.com/sumithemmadi/truecallerjs/issues/32#issue-1798238785

PalmerMontalvo commented 1 year ago

@PalmerMontalvo Your old phone number still don't work 2 days after this? #32 (comment)

Still doesn't work.

RabbitFored commented 1 year ago

Here is a considerable amount of data I managed to process:

Accounts tested : 218

Success - 114
Failed  - 104
  -> Unauthorized : 21
  -> Too many requests : 0
  -> Status [426] : 83

83 out of 218 installation IDs ( each of individual phone number ) get status code 426.

But these accounts worked before few days.

PalmerMontalvo commented 1 year ago

I also noticed that when generating keys using completely new numbers, 426 errors are also returned. Something might be wrong with the key generation phase.

sumithemmadi commented 1 year ago

"Client must be upgraded," implies that the server requires the client to upgrade its protocol or version. It could be a problem with the HTTP version or the Truecaller version.

According to the error message, it is using HTTP version 1.1, but it doesn't specify the exact version to upgrade. The same HTTP version 1.1 works on my PC, but I don't know why it's not working on yours.

To troubleshoot the issue, you can try using different Node.js version or different device or different networks, I just want to know if the problem is with your pc or nodejs version or truecallerjs code . See if the same error persists, and please let me know.

RabbitFored commented 1 year ago

If it is about http version then why only some selective accounts (all tested in same pc) get this error?

RabbitFored commented 1 year ago

"Client must be upgraded," implies that the server requires the client to upgrade its protocol or version. It could be a problem with the HTTP version or the Truecaller version.

According to the error message, it is using HTTP version 1.1, but it doesn't specify the exact version to upgrade. The same HTTP version 1.1 works on my PC, but I know why it's not working on yours.

To troubleshoot the issue, you can try using different Node.js version or different device or different networks, I just want to know if the problem is with your pc or nodejs version or truecallerjs code . See if the same error persists, and please let me know.

Yeah, I tested with truecallerpy and curl both showed same response ( code 426 ), but if I use other installation ID it works fine. Only some ( 82 of 218 tested ) accounts get this error.

RabbitFored commented 1 year ago

Any update on this issue? @sumithemmadi

sumithemmadi commented 1 year ago

Can you log in to the Truecaller app with the phone numbers that failed while logging in with Truecallerjs ?

PalmerMontalvo commented 1 year ago

@sumithemmadi , yes but Truecaller app shows popup "Your account is temporarily blocked" and then you need to go through google captcha.

RabbitFored commented 1 year ago

Yeah, I too get something like this while I login using official Truecaller app.

IMG_20230723_230054 IMG_20230723_230111

deepesh-agarwal commented 7 months ago

Same here - 426 Upgrade Required, only 10-15 lookups a day.

deepesh-agarwal commented 7 months ago

@RabbitFored Any solutions? Will an upgrade to truecaller premium fix this?

adarshsingh10100 commented 5 months ago

I'm getting same error - truecallerjs -s +918512094572

message : Request failed with status code 426 name : AxiosError stack : AxiosError: Request failed with status code 426 at settle (file:///data/data/com.termux/files/usr/lib/node_modules/truecallerjs/node_modules/axios/lib/core/settle.js:19:12) at Unzip.handleStreamEnd (file:///data/data/com.termux/files/usr/lib/node_modules/truecallerjs/node_modules/axios/lib/adapters/http.js:589:11) at Unzip.emit (node:events:523:35) at endReadableNT (node:internal/streams/readable:1367:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) at Axios.request (file:///data/data/com.termux/files/usr/lib/node_modules/truecallerjs/node_modules/axios/lib/core/Axios.js:45:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async runCLI (file:///data/data/com.termux/files/usr/lib/node_modules/truecallerjs/dist/cli.js:236:35) config : transitional : silentJSONParsing : true forcedJSONParsing : true clarifyTimeoutError : false adapter : xhr, http transformRequest : null transformResponse : null timeout : 0 xsrfCookieName : XSRF-TOKEN xsrfHeaderName : X-XSRF-TOKEN maxContentLength : -1 maxBodyLength : -1 env : {} headers : Accept : application/json, text/plain, / Content-Type : application/json; charset=UTF-8 accept-encoding : gzip user-agent : Truecaller/11.75.5 (Android;10) Authorization : Bearer a1i0d--kyf3MK-MV3yhxCOVCBx3xAy7zKQ26-yptF5zgLiDHFJf67ZD0d793Di9Y params : q : 8512094572 countryCode : IN type : 4 locAddr : placement : SEARCHRESULTS,HISTORY,DETAILS encoding : json method : get url : https://search5-noneu.truecaller.com/v2/search code : ERR_BAD_REQUEST status : 426 ~ $

arunp7 commented 4 months ago

@sumithemmadi Do we have a solution for this issue?

anubhavanonymous commented 4 months ago

This is so frustrating

Navitas28 commented 3 months ago

@deepesh-agarwal same issue with the premium accounts, even now with same number can't login to mobile app also

Prathmeshgurav commented 4 weeks ago

I got the answer to solve status code 401 just login once again and it will solve

Av1dLearner commented 4 weeks ago

I got the answer to solve status code 401 just login once again and it will solve

Doesn't help for 426

SDPLDSE commented 2 weeks ago

ANY SOLUTIONS FOUND FOR Client must be upgraded?