-
Notifications
You must be signed in to change notification settings - Fork 78
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
incompatibility with werkzeug 2.1+ and room for improvement in catching exceptions #323
Comments
Feel free to submit pull requests for any improvements. |
Werkzeug 2.1+ created incompatibility (pallets/werkzeug#2339) which caused plugin to fail with "400 Bad Request". Fixes one (main) part of OctoPrint#323
Werkzeug 2.1+ created incompatibility (pallets/werkzeug#2339) which caused plugin to fail with "400 Bad Request". Fixes one (main) part of OctoPrint#323
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.
pallets/werkzeug#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)
The text was updated successfully, but these errors were encountered: