bard-ai
bard-ai copied to clipboard
🐛 [BUG]: Working with Windows, Crashing on Linux
Prerequisites
- [X] I have searched the issues and believe that it has not already been reported
- [X] It occurs on the latest version of
bard-ai - [X] I have read the FAQ and there are no solutions there
Bug Description
So i coded a Discord Bot in Discord.JS in CJS and imported it correctly and everything works when using it in Windows, but when i upload it to a Linux Server(Running Ubuntu 20) it crashes when using Bard.Chat().ask() trying to ask something...
Reproduction Steps
Using:
const Bard = await import("bard-ai").catch(e => {
throw "Missing Module: The Package 'bard-ai' was not found, please install it manually using 'npm i bard-ai'"
});
await Bard.init(config.aicookie);
let conv = new Bard.Chat();
await conv.ask("A MSG");
After i start the Bot it Gives this Error:
node:events:492
throw er; // Unhandled 'error' event
^
Error: Google Bard encountered an error )]}'
38
[["wrb.fr",null,null,null,null,[9]]]
55
[["di",81],["af.httprm",80,"-1146363392943947525",2]]
25
[["e",4,null,null,130]]
.
at queryBard (file:///Bot/node_modules/bard-ai/index.js:88:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Chat.ask (file:///Bot/node_modules/bard-ai/index.js:147:23)
at async Object.execute (/Bot/events/ready.js:87:9) // This Being the Lines i sent Above: await conv.ask()
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:395:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
Node.js v18.17.0
Other information
No response
Occurance Rate
I can reproduce this bug 100% of the time.
It appears that Bard is not responding correctly. Are you sure that config.aicookie is defined in your new environment?
Yeah it is... i checked it multiple times and it does work on windows but not on the ubuntu server. The config is a JSON file that i imported using require...
I have already pretty much created a CRE... But everything i have tried doesn't work... it throws the same error as of the start of this issue. I tried reimporting the Module, Making a new Project, trying a new File, Trying a ES6 Project, importing it using the import() function... Even just putting the Cookie Secret as a string into the function... Do you guys have any idea how i might be able to fix this?
Weirdly enough i have now tried running this Project in a Ubuntu 20 VM on my PC and it works there.. So i think there might be something wrong with my Server i am running it on....
Hello, This error happens to me when I try to use the chat function without passing the ids form the export function first. Other than that it works.
Any updates? Closing otherwise.
I still haven't found a solution for the issue but i do want to use it without a id...
Try with bard-ai v2. Just released.
There are quite a few breaking changes though 😅
Overall, the experience should be more streamlined and modern.
It did? Okay i will test that... i will report tomorrow if it works or not...
file:///Bot/node_modules/bard-ai/index.js:242
const answer = chatData[4][0];
^
TypeError: Cannot read properties of null (reading '4')
at #query (file:///Bot/node_modules/bard-ai/index.js:242:32)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Chat.ask (file:///Bot/node_modules/bard-ai/index.js:344:32)
at async /Bot/test.js:7:17
Node.js v18.17.0
Getting this error now... but works on my PC again... No idea why it happens...
Using:
import("bard-ai").then(async ({ default: Bard }) => {
let bard = new Bard({
"__Secure-1PSID": "COOKIE SECRET",
"__Secure-1PSIDTS": "COOKIE SECRET",
});
let conv = bard.createChat();
console.log(await conv.ask("test"));
});
Can you give a minimal recreation of your problem?
Like complete code to recreate the problem you are having.
The Code i sent is everything i tested it with...