Closed arekm closed 2 years ago
Feel free to submit pull requests for any improvements.
This issue has been automatically marked as stale because it has not had any recent activity. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed in 5 days.
The problem is still there but issue can be closed. There is a open pull request fixing it.
This issue has been automatically locked because there was no further activity after it was closed. Please open a new issue for any related problems.
Hardware Setup prusa mk3s+
Describe the problem Plugin worked fine until I tried it on fresh system using octoprint from maintenance branch.
Browser inspector shows me that POST call to /flash plugin endpoint is being made and server returns:
400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
So that's the first problem - javascript part of flash plugin doesn't react correctly if endpoint returns any error. It should display some error to user in such case.
flash_firmware(self)
(that's not catched inside) is not logged by octoprint. Don't know why.To figure out what's happening I'm putting entire flash_firmware content in
block and now we have something:
werkzeug 2.1+ has a change which will raise BadRequest exception if there are json calls while Content-Type is not application/json. For firmwareupdater part Content-Type is multipart/form-data if I remember correctly.
https://github.com/pallets/werkzeug/issues/2339
Solution for this is doing
instead of current
So that was second problem - incompatibility with werkzeug 2.1+. With above change flashing succeeds.
And last thing, entire _flash_worker() should also sit in try except block since any exception there (that's not already catched inside) will be silently ignored without any trace in octoprint.log (as this is run in Thread and octoprint doesn't get exceptions from separate thread).
About octoprint not catching and logging exception in flash_firmware I'm not sure. IMO it should catch it and log it since it is not run in separate thread (I think). Probably flask is catching it or something. Didn't dig deeper.
Edit:
seems to work (but possibly too broad)