realcoloride / node_characterai

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

ProtocolError #166

Closed gamersindo1223 closed 1 month ago

gamersindo1223 commented 4 months ago

Hi, This is an issue that I've encountered now. This issue happened just now, sometimes I got this error or it's stuck after sending message (noresponse): ProtocolError: Could not load body for this request. This might happen if the request is a preflight request.

realcoloride commented 4 months ago

Hello, could you send the stack trace?

gamersindo1223 commented 4 months ago

This another error that I got

[node_characterai] Puppeteer - Error: net::ERR_FAILED at https://character.ai/chat/history/continue/
/root/rest-api/node_modules/node_characterai/client.js:144
        if (request.status() === 200 || request.status() === 404) {
                    ^

TypeError: Cannot read properties of undefined (reading 'status')

and other than that it would just hang

realcoloride commented 4 months ago

What version of the package are you using?

gamersindo1223 commented 4 months ago

node_characterai@1.2.7

sivertheisholt commented 4 months ago

Been getting this randomly too, not often. But maybe 2-3 times when used for 3-4 hours continuously.

realcoloride commented 4 months ago

This is weird because I do not think I've ever encountered this before. Whats your operating system and chromium version? I personally cannot reproduce this issue (yet).

Could you guys try to open the browser up (switching headless to false) and leave the network tab open so whenever the issue happens you check what happened? or just print whatever comes out as a response.

Related to the ProtocolError issue, I don't know what could be causing this. Perhaps CharacterAI (or the old interface) is going through downtimes or maintenances? However I've found this: https://github.com/puppeteer/puppeteer/issues/9864#issuecomment-1620651839 which could indicate its perhaps not an error caused by the package.

Once you've tested and the error happens again, show me as much as information you got from the error and then try to uninstall the node_characterai package along with puppeteer and reinstall it and see if it happens again.

sivertheisholt commented 4 months ago

This is weird because I do not think I've ever encountered this before. Whats your operating system and chromium version? I personally cannot reproduce this issue (yet).

Could you guys try to open the browser up (switching headless to false) and leave the network tab open so whenever the issue happens you check what happened? or just print whatever comes out as a response.

Related to the ProtocolError issue, I don't know what could be causing this. Perhaps CharacterAI (or the old interface) is going through downtimes or maintenances? However I've found this: puppeteer/puppeteer#9864 (comment) which could indicate its perhaps not an error caused by the package.

Once you've tested and the error happens again, show me as much as information you got from the error and then try to uninstall the node_characterai package along with puppeteer and reinstall it and see if it happens again.

Running the library in self hosted Docker as a Service with REST. Its probably Character AI having issues to be honest, because today its been running without issues. I have added file logging, so I will provide the logs if it happens again.

realcoloride commented 4 months ago

Okay thank you. Sadly, if it is a CharacterAI issue, I cannot do much for now. However I recommend you use something like pm2 to automatically restart your script if it crashes or whatnot.

Good luck and keep me updated.

gamersindo1223 commented 4 months ago

@realcoloride just checked the logs, looks lke this happened because the new interface I think,

Is there any plan to use the new c.ai website so this issue would probably get fixed? Thanks

realcoloride commented 4 months ago

Hello,

Could you send me the logs/traces?

As I said before, I will use the old interface as long as possible (for compatibility & stability reasons). I will switch to using the new interface and endpoints when the old interface will no longer work or be fully broken.

gamersindo1223 commented 4 months ago

@realcoloride I'm sorry but looks like I can't provide it, because it would stuck indefinitely without giving any output

gamersindo1223 commented 3 months ago

@realcoloride hmm this issue still exist? is there any update?

realcoloride commented 3 months ago

Shouldn't. Could you try & let me know?

gamersindo1223 commented 3 months ago

nvm I need to reinstall my whole node_modules to fix this issue, and/or use another session_id from other account