dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.93k stars 1.14k forks source link

Aws server - Please wait a few minutes before you try again. #1323

Open ozturkilgim opened 3 years ago

ozturkilgim commented 3 years ago

Bug Report

My aws server faces with this error: Aws server - Please wait a few minutes before you try again.

I have changed accounts and waited a few minutes but it didn't work. Approximately 200 different users per hour uses our app, which was combined with this server.

Code

const start = async () => {
  ig.request.defaults.agentClass = shttps; // apply agent class to request library defaults
  ig.request.defaults.agentOptions = {
    // @ts-ignore
    hostname: '107*****', // proxy hostname
    port: 1080, // proxy port
    protocol: 'socks5:', // supported: 'socks:' , 'socks4:' , 'socks4a:' , 'socks5:' , 'socks5h:'
    userId: 'qyn****', // proxy username, optional
    password: 'fz*****', // proxy password, optional
  };

  try {
    // await ig.simulate.preLoginFlow();
    console.log("Trying to log in");
    await ig.account.login(IG_USERNAME, IG_PASSWORD);
    process.nextTick(async () => await ig.simulate.postLoginFlow());
    const loggedInUser = await ig.account.login(IG_USERNAME, IG_PASSWORD);
    console.log("loggedInUser", loggedInUser);
  } catch (e) {
    console.log("ERR: ", e);
    await ig.challenge.auto(true);
    console.log("challenge");
    let ch = ig.state.challenge;
    prompt.start();
    console.log("prompt start");
    if (ch.step_name == "submit_phone" && ch.step_data.phone_number == "None") {
      prompt.get(["phone"], async function (err, result) {
        await ig.challenge.sendPhoneNumber(result.phone);
      });
    }
    prompt.get(["code"], async function async(err, result) {
      const stringCode = result.code.toString();
      try {
        await ig.challenge.sendSecurityCode(stringCode);
        // await ig.simulate.preLoginFlow();
        // await ig.account.login(IG_USERNAME, IG_PASSWORD)
        // process.nextTick(async () => await ig.simulate.postLoginFlow());
        // const loggedInUser = await ig.account.login(IG_USERNAME, IG_PASSWORD);
      } catch (e) {
        await ig.challenge.replay("0");
      }
    });
  }
};

Error and Output

npm start

insta@1.0.0 start node index.js

Trying to log in (node:62159) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created) IG server started on port 3000 ERR: IgResponseError: POST /api/v1/accounts/login/ - 429 -; Please wait a few minutes before you try again. at Request.handleResponseError (/home/ubuntu/teamfluencer-instagram-api/node_modules/instagram-private-api/dist/core/request.js:125:16) at Request.send (/home/ubuntu/teamfluencer-instagram-api/node_modules/instagram-private-api/dist/core/request.js:53:28) /home/ubuntu/teamfluencer-instagram-api/node_modules/instagram-private-api/dist/repositories/challenge.repository.js:57 throw new errors_1.IgNoCheckpointError(); ^

IgNoCheckpointError: No checkpoint data available at ChallengeRepository.auto (/home/ubuntu/teamfluencer-instagram-api/node_modules/instagram-private-api/dist/repositories/challenge.repository.js:57:19) at start (/home/ubuntu/teamfluencer-instagram-api/index.js:33:24) npm ERR! code 1 npm ERR! path /home/ubuntu/teamfluencer-instagram-api npm ERR! command failed npm ERR! command sh -c node index.js

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2020-11-27T09_49_19_337Z-debug.log`You can get the stacktrace in the most environments using

adventurist commented 3 years ago

I have been encountering this with all my users on my cloud machines

No problems running the same code from my local machine.

panji31 commented 2 years ago

change your account or proxy

adventurist commented 2 years ago

Yes, to close, I setup a proxy and all is good :)