threads-api
threads-api copied to clipboard
Can't publish anything: UnhandledPromiseRejectionWarning: TypeError: i.sent(...).data.split(...)[1].split(...)[0].replaceAll is not a function
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.
In general, I've seen this error happen more often with private accounts or when Instagram has secondary security.
- If it's a private account, you need to convert it to a public account.
- you need to change the security level of your Instagram to be accessible with just a password.
- You should try logging in from a different browser session and see if there are any issues.
I am also facing same issue. My account is public. @Mineru98 can you please share more details regarding point 2
ok it working after updating to node 16 https://stackoverflow.com/a/76461878
you can close this issue
Legend! Problem solved.