smartin015 / continuousprint

Octoprint plugin to allow the creation of a print queue that prints, clears the bed and then prints again
40 stars 38 forks source link

Continuous Print API (Error 500) thrown every time the plugin screen is open. #224

Open snickerdudle opened 1 year ago

snickerdudle commented 1 year ago

Describe the bug On 2 separate OctoPrint instances, after updating the package I can no longer navigate to the Continuous Print tab in the interface. Whenever I do, a Continuous Print API (Error 500) error is thrown. Please see the log from the request in the Additional Context section below.

The last functional version I had before the update to 2.4.0 was 2.1.1, but now when trying to manually install 2.1.1 the same error occurs.

To Reproduce

  1. Update to 2.4.0 from 2.1.1
  2. Go to the Continuous Print tab

System info: octoprint-systeminfo-20230310204809.zip

Browser logs: octopi.local-1678482130366.log

Additional context Here is the octoprint log:

2023-03-10 20:43:58,748 - octoprint.plugins.tracking - INFO - Sent tracking event webui_load, payload: {'browser_name': 'Chrome', 'browser_version': '110.0.0.0', 'os_name': 'Mac OS', 'os_version': '10.15.7'}
2023-03-10 20:44:02,460 - octoprint - ERROR - Exception on /plugin/continuousprint/state/get [GET]
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1519, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/util/flask.py", line 1575, in decorated_view
    return no_firstrun_access(flask_login.login_required(func))(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/util/flask.py", line 1598, in decorated_view
    return func(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/continuousprint/api.py", line 88, in cpq_permission_wrapper
    return func(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/continuousprint/api.py", line 163, in get_state
    return self._state_json()
  File "/home/pi/oprint/lib/python3.7/site-packages/continuousprint/plugin.py", line 810, in _state_json
    for name, q in self.q.queues.items()
AttributeError: 'CPQPlugin' object has no attribute 'q'
2023-03-10 20:44:02,512 - octoprint - ERROR - Exception on /plugin/continuousprint/history/get [GET]
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1519, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/util/flask.py", line 1575, in decorated_view
    return no_firstrun_access(flask_login.login_required(func))(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/util/flask.py", line 1598, in decorated_view
    return func(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/continuousprint/api.py", line 88, in cpq_permission_wrapper
    return func(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/continuousprint/api.py", line 299, in get_history
    return self._history_json()
  File "/home/pi/oprint/lib/python3.7/site-packages/continuousprint/plugin.py", line 828, in _history_json
    if self.q.run is not None:
AttributeError: 'CPQPlugin' object has no attribute 'q'
2023-03-10 20:44:09,611 - octoprint.plugins.dashboard - ERROR - Frontend javascript error detected (this error is not necesarily to do with dashboard):
Message: Uncaught TypeError: Cannot read properties of null (reading 'newEmptyJob') - URL: http://octopi.local/static/webassets/packed_plugins.js?cd322e5d - Line: 5889 - Column: 33 - Error object: {}
2023-03-10 20:44:09,612 - octoprint.JsFrontendErrors(Dash) - ERROR - Message: Uncaught TypeError: Cannot read properties of null (reading 'newEmptyJob') - URL: http://octopi.local/static/webassets/packed_plugins.js?cd322e5d - Line: 5889 - Column: 33 - Error object: {}
smartin015 commented 1 year ago

Hey @snickerdudle - sorry the update broke your setup, and thanks for the report. I usually test compatibility with the previous release, so sometimes multi-release compatibility issues sneak in.

Usually the issue lies in updates to the DB schema, so solve your problem specifically I'd recommend clearing plugin data and rebooting.

I'm going to leave this bug open so I can take a look at the sysinfo bundle you've attached and fix the issue so the upgrade goes more smoothly for future folks.