EvanZhouDev / bard-ai

A lightweight library to access Google Bard.
https://www.npmjs.com/package/bard-ai
GNU General Public License v3.0
117 stars 31 forks source link

🐛 [BUG]: TypeError: Cannot read properties of null (reading '4') #60

Open eliiran1231 opened 1 year ago

eliiran1231 commented 1 year ago

Prerequisites

Bug Description

sometimes i get this error while talking to bard, after some digging, turns out that the variable chatData is null sometimes due to a problem in the parsing from json. here is the full error:

TypeError: Cannot read properties of null (reading '4') at #query (file:///C:/Users/mma91/OneDrive/%D7%A9%D7%95%D7%9C%D7%97%D7%9F%20%D7%94%D7%A2%D7%91%D7%95%D7%93%D7%94/milki/node_modules/bard-ai/index.js:240:32) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Chat.ask (file:///C:/Users/mma91/OneDrive/%D7%A9%D7%95%D7%9C%D7%97%D7%9F%20%D7%94%D7%A2%D7%91%D7%95%D7%93%D7%94/milki/node_modules/bard-ai/index.js:353:32) at async bardAI (file:///C:/Users/mma91/OneDrive/%D7%A9%D7%95%D7%9C%D7%97%D7%9F%20%D7%94%D7%A2%D7%91%D7%95%D7%93%D7%94/milki/index.js:53:22) at async file:///C:/Users/mma91/OneDrive/%D7%A9%D7%95%D7%9C%D7%97%D7%9F%20%D7%94%D7%A2%D7%91%D7%95%D7%93%D7%94/milki/index.js:115:32

Reproduction Steps

talk to bard for a while, i did notice it tends happen more in the evening

Other information

No response

Occurance Rate

I can reproduce this bug 60% of the time.

ThatXliner commented 1 year ago

Possible duplicate of #53

eliiran1231 commented 1 year ago

Possible duplicate of #53

bard is available in my country and i use the latest verison

EvanZhouDev commented 1 year ago

Are you using the __Secure-1PSIDTS cookie as well? See docs here: https://bard-ai.js.org/faq/#cant-use-bard

izhekka commented 1 year ago

I'm using both __Secure-1PSID and __Secure-1PSIDTS and face the same issue occasionally. Refreshing the __Secure-1PSIDTS cookie solves the issue.