realcoloride / node_characterai

Unofficial Character AI wrapper for node.
https://beta.character.ai/
341 stars 72 forks source link

Authentication Error #140

Closed KOTOKOPOLb closed 7 months ago

KOTOKOPOLb commented 7 months ago

Trying to run the code on the hosting, I get the error Error: Failed to launch the browser process! /home/container/.cache/puppeteer/chrome/linux-121.0.6167.85/chrome-linux64/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory , although all dependencies are installed (as the hosting owner says) image

realcoloride commented 7 months ago

See https://github.com/realcoloride/node_characterai?tab=readme-ov-file#troubleshooting.

KOTOKOPOLb commented 7 months ago

We looked and tried different options, but could not find a solution

realcoloride commented 7 months ago

Have you tried to correctly set the path where the chromium instance is located?

KOTOKOPOLb commented 7 months ago

The path is correct (I checked several times), if you specifically specify the wrong path, there will be an error about the absence of a chrome instance (which proves that the path is correct)

realcoloride commented 7 months ago

Are you sure you have checked the path and set the path accordingly before initializing?

KOTOKOPOLb commented 7 months ago

Yes, I am sure

realcoloride commented 7 months ago

Show me your code and show the output of the which command.

KOTOKOPOLb commented 7 months ago
const CharacterAI = require("node_characterai");
const characterAI = new CharacterAI();

(async () => {
  characterAI.puppeteerPath = "/home/container/.cache/puppeteer/chrome/linux-121.0.6167.85/chrome-linux64/chrome";
  await characterAI.authenticateAsGuest();
  const characterId = "8_1NyR8w1dOXmI1uWaieQcd147hecbdIK7CeEAIrdJw";
  const chat = await characterAI.createOrContinueChat(characterId);
  //const response = await chat.sendAndAwaitResponse("Hello discord mod!", true);
  //console.log(response);
})();
realcoloride commented 7 months ago

Now show me the output of the which command.

KOTOKOPOLb commented 7 months ago

Since I don't have direct access to the console, I wrote a small code

const { exec } = require('child_process')
exec('which chromium-browser', (err, output) => {
    if (err) {
        console.error("could not execute command: ", err)
        return
    }
    console.log("Output: \n", output)
})

that returns

could not execute command:  Error: Command failed: which chromium-browser
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:337:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'which chromium-browser'
}
realcoloride commented 7 months ago

There lies your issue. You need to run the command to know the path to run chromium.

KOTOKOPOLb commented 7 months ago

I asked the hosting owner to send the output of the command, he wrote that the command did not return anything.