Rettiwt-API: Request failed with status code 429 when use in remote/cloud environment

I am using rettiwt.user.details(id) and I am getting the error below.

{
"message": "Request failed with status code 429",
"name": "AxiosError",
"stack": "AxiosError: Request failed with status code 429\n    at eL (/var/task/.next/server/chunks/151.js:16:36057)\n    at Unzip.<anonymous> (/var/task/.next/server/chunks/151.js:18:8452)\n    at Unzip.emit (node:events:529:35)\n    at endReadableNT (node:internal/streams/readable:1368:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)",
"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/x-www-form-urlencoded",
"authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
"User-Agent": "axios/1.4.0",
"Accept-Encoding": "gzip, compress, deflate, br"
},
"method": "post",
"url": "https://api.twitter.com/1.1/guest/activate.json",
"data": null
},
"code": "ERR_BAD_REQUEST",
"status": 429
}

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

After extensive testing, I came to the following conclusions:

  • As we know, fetching data without logging in uses something called a guest_token, which is fetched from the /1.1/auth/activate.json endpoint.
  • This endpoint belongs to the v1.1 API of Twitter (which has been deprecated as of now, but is still used by the Twitter Web-App). The v1.1 API blocks all connections from IP ranges belonging to cloud service providers, and throws an error 429.
  • Now, for fetching data, v2 API endpoints are used, which does not block connections from IP ranges belonging to cloud service providers.
  • As such, when an application is deployed to a cloud environment, interacting with the API without logging in is not possible.

Therefore, @taroj1205 your only option as of now is to generate an API_KEY and use ‘user’ authentication instead of ‘guest’ authentication, when you are deploying your application to the cloud.

Thanks for you patience and feedback!