realcoloride/node_characterai

Authentication Error

KOTOKOPOLb opened this issue · 12 comments

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

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

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

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)

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

Yes, I am sure

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

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);
})();

Now show me the output of the which command.

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'
}

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

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