Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [BUG]: Working with Windows, Crashing on Linux #47

Open
3 tasks done
XCraftTM opened this issue Jul 24, 2023 · 13 comments
Open
3 tasks done

馃悰 [BUG]: Working with Windows, Crashing on Linux #47

XCraftTM opened this issue Jul 24, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@XCraftTM
Copy link

Prerequisites

  • I have searched the issues and believe that it has not already been reported
  • It occurs on the latest version of bard-ai
  • 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.

@XCraftTM XCraftTM added the bug Something isn't working label Jul 24, 2023
@EvanZhouDev
Copy link
Owner

It appears that Bard is not responding correctly. Are you sure that config.aicookie is defined in your new environment?

@XCraftTM
Copy link
Author

XCraftTM commented Jul 25, 2023

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...

@XCraftTM
Copy link
Author

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?

@XCraftTM
Copy link
Author

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....

@MarwanRadwan7
Copy link

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.

@EvanZhouDev
Copy link
Owner

Any updates? Closing otherwise.

@XCraftTM
Copy link
Author

XCraftTM commented Aug 2, 2023

I still haven't found a solution for the issue but i do want to use it without a id...

@EvanZhouDev
Copy link
Owner

Try with bard-ai v2. Just released.

@EvanZhouDev
Copy link
Owner

There are quite a few breaking changes though 馃槄

Overall, the experience should be more streamlined and modern.

@XCraftTM
Copy link
Author

XCraftTM commented Aug 2, 2023

It did? Okay i will test that... i will report tomorrow if it works or not...

@XCraftTM
Copy link
Author

XCraftTM commented Aug 3, 2023

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

@EvanZhouDev
Copy link
Owner

EvanZhouDev commented Aug 3, 2023

Can you give a minimal recreation of your problem?

Like complete code to recreate the problem you are having.

@XCraftTM
Copy link
Author

XCraftTM commented Aug 3, 2023

The Code i sent is everything i tested it with...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants