jamf / JAWA

Jamf Automation and Webhook Assistant
MIT License
133 stars 12 forks source link

Incompatibility with Flask 3.x and Werkzeug 3.x #42

Closed mhershberger closed 1 year ago

mhershberger commented 1 year ago

While configuring a new JAWA server today on RHEL, I ran into these errors when starting the jawa service (copied from journalctl -u jawa.service):

ImportError: cannot import name 'escape' from 'flask' (/usr/local/jawa/venv/lib64/python3.9/site-packages/flask/init.py)

and

ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/jawa/venv/lib64/python3.9/site-packages/werkzeug/urls.py)

This resulted in a 502 Bad Gateway error when trying to load the HTTPS site.

Comparing the output of /usr/local/jawa/venv/bin/pip3 list on my working dev server to my non-working new server, I found that the working server was running Flask 2.2.2 and Werkzeug 2.2.2, while the failing server had version 3.0 of each.

After downgrading both packages like so...

/usr/local/jawa/venv/bin/pip3 install Flask==2.2.2 /usr/local/jawa/venv/bin/pip3 install Werkzeug==2.2.2

...and then rebooting the server, the site is up and running.

As a quick fix, I suggest specifying the version of these libraries in requirements.txt so new installs will work. Long-term, ideally JAWA could be updated to support the newer libraries.

ball42 commented 1 year ago

Resolved in #44 - thanks for the report! If you do a fresh install, the new requirements.txt file will avoid the issue.