threads-api icon indicating copy to clipboard operation
threads-api copied to clipboard

Can't publish anything: UnhandledPromiseRejectionWarning: TypeError: i.sent(...).data.split(...)[1].split(...)[0].replaceAll is not a function

Open getrasa opened this issue 1 year ago • 1 comments

Here's the code:

const main = async () => {
    const accountUsername = "my_username";
    const accountPassword = "my_password";
    const threadsApi = new ThreadsAPI({username: accountUsername, password: accountPassword})

    const success = await threadsApi.publish("Publishing test!");
      console.log(`Status: ${success ? 'Success' : 'Failure'}`);
}
main();

As you can see vary basic example.

And here's an error:

 UnhandledPromiseRejectionWarning: TypeError: i.sent(...).data.split(...)[1].split(...)[0].replaceAll is not a function
    at d.<anonymous> (/home/getrasa/work/threads/threads-auto-ts/node_modules/threads-api/build/threads-api.js:1:9832)
    at /home/getrasa/work/threads/threads-auto-ts/node_modules/threads-api/build/threads-api.js:1:1769
    at Object.next (/home/getrasa/work/threads/threads-auto-ts/node_modules/threads-api/build/threads-api.js:1:1874)
    at o (/home/getrasa/work/threads/threads-auto-ts/node_modules/threads-api/build/threads-api.js:1:350)
    at i (/home/getrasa/work/threads/threads-auto-ts/node_modules/threads-api/build/threads-api.js:1:547)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28058) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28058) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

getrasa avatar Jul 10 '23 11:07 getrasa

In general, I've seen this error happen more often with private accounts or when Instagram has secondary security.

  1. If it's a private account, you need to convert it to a public account.
  2. you need to change the security level of your Instagram to be accessible with just a password.
  3. You should try logging in from a different browser session and see if there are any issues.

Mineru98 avatar Jul 10 '23 16:07 Mineru98

I am also facing same issue. My account is public. @Mineru98 can you please share more details regarding point 2

itsnikhil avatar Jul 10 '23 23:07 itsnikhil

ok it working after updating to node 16 https://stackoverflow.com/a/76461878

itsnikhil avatar Jul 10 '23 23:07 itsnikhil

you can close this issue

itsnikhil avatar Jul 10 '23 23:07 itsnikhil

Legend! Problem solved.

getrasa avatar Jul 11 '23 06:07 getrasa