A BAD REQUEST error occurs when trying to connect to OctoPrint with the code below. Looking at the caught error, it was responseJSON: {error: 'port is invalid'}.
http://192.168.0.17:5000/ from a web browser displays the GUI normally. Can you guess what's wrong?
Client = new OctoPrintClient({
baseurl: 'http://192.168.0.17:5000/',
apikey: serverApikey,
});
Client.files.list();
From what kind of environment are you trying to run this code?
I am not sure where in OctoPrint I would find an error message for the port being wrong, I am surprised to see that.
1 Like
Dear Charlie Powell
Thank you for your reply.
sorry. It was due to my careless mistake.
After much research, the Promise on OctoPrintClient.connection.connect failed and the responseJSON was {Error: 'Invalid port'}. I just didn't connect the 3D printer to the serial port.
I'm embarrassed, I'm sorry.