junhoyeo / threads-api

Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's Threads. Web UI Included.
https://threads.junho.io
MIT License
1.59k stars 134 forks source link

🦖 Issue on Deno runtime #140

Open SethuSenthil opened 1 year ago

SethuSenthil commented 1 year ago

Here is a simple example I used to test in Deno:

import ThreadsAPI from "npm:threads-api@^1.4.1";

const main = async () => {
  const threadsAPI = new ThreadsAPI.ThreadsAPI({
    username: "USERNAME", // Your username
    password: "PASSWORD", // Your password
  });

  await threadsAPI.publish("Something....");
};

main();

The error i received was:

error: Uncaught (in promise) TypeError: Error parsing args at position 0: serde_v8 error: invalid type; expected: buffer, got: unknown
    at Object.publicEncrypt (ext:deno_node/internal/crypto/cipher.ts:182:16)
    at a.<anonymous> (file:///Users/sethusenthil/Desktop/Code/thread-year-prog-bot/node_modules/.deno/threads-api@1.4.1/node_modules/threads-api/build/threads-api.js:1:3421)
    at file:///Users/sethusenthil/Desktop/Code/thread-year-prog-bot/node_modules/.deno/threads-api@1.4.1/node_modules/threads-api/build/threads-api.js:1:2034
    at Object.next (file:///Users/sethusenthil/Desktop/Code/thread-year-prog-bot/node_modules/.deno/threads-api@1.4.1/node_modules/threads-api/build/threads-api.js:1:2139)
    at a (file:///Users/sethusenthil/Desktop/Code/thread-year-prog-bot/node_modules/.deno/threads-api@1.4.1/node_modules/threads-api/build/threads-api.js:1:615)
    at i (file:///Users/sethusenthil/Desktop/Code/thread-year-prog-bot/node_modules/.deno/threads-api@1.4.1/node_modules/threads-api/build/threads-api.js:1:812)
    at Object.runMicrotasks (ext:core/01_core.js:836:30)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:14)
    at runNextTicks (ext:deno_node/_next_tick.ts:71:5)
    at eventLoopTick (ext:core/01_core.js:189:21)

I think it is something within the encryption logic or dependency (crypto js maybe?) which does not work well with the deno runtime for whatever reason