-
Notifications
You must be signed in to change notification settings - Fork 11
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid JSON response body when starting up #32
Comments
My personal Lemmy instance is running 0.18.0, and lemmy-bot has no problem logging in. However, I'm seeing the
|
I'm trying to figure out if this is a problem with the bot library, the js client library, or the server-side of the API. I'm seen similar errors of invalid JSON bodies pop up in error toasts on the UI project sometimes. |
The error messages seem to be coming this way because Lemmy API returns plain text instead of JSON. This issue just got closed, so hopefully, the errors will be handled in a more useful way in the next release: LemmyNet/lemmy#3366 However, I still don't know what is triggering the error for me in the first place. I am not that good with Typescript yet, so I am probably doing something wrong, but getting a more reasonable error message should help me as I try to figure it out. |
I am getting this error as well. I have lemmy-bot 0.4.5, node 18.16.1, npm 9.5.1. I am just learning node, etc... really. I just created a new project, a new index.js in that folder and then copied in the Congratulator bot example, since that's close to what I want to do. I did 'npm init' and 'npm install'. I edited the credentials, and the comment text in the JS file. I run it as 'node index.js' from the terminal and getting the Invalid JSON message above.
Is there anything I can edit on my PC to get this working? Or do we need to wait for the next Lemmy release? Thanks for any pointers. EDIT TO ADD: Thanks to sylverstream, I added the same console.log() and got this:
EDIT TO ADD AGAIN: I found a defect in my bot script. It was passing in "postId" but should have passed "post_id". With that fixed, my bot is working! @sylverstream - check your code for a similar mistake, maybe. I think the bot library itself is OK, in other words. |
I've also got the same error. In my case, the logging in fails. I've added a console.log in node_modules/node-fetch/lib/index.js to see the Lemmy response. In my case the error returned by Lemmy.world is: @SleeplessOne1917 hopefully that helps? |
I wonder, are we still waiting on an update to Lemmy before this is addressed? For me this only happens when trying to pin a post using Lemmy-Frank-Bot. |
Lemmy version 0.19.0 is going to release (hopefully) this week, so hopefully this will allow us to check whether this is an issue with the API or the bot. |
I've got a bot for lemmy.world and it has stopped working since they've upgraded to 0.18.1-rc.4
It fails at logging in:
I've double checked, the account credentials I'm passing in are valid.
The text was updated successfully, but these errors were encountered: