<p dir="auto">Relates to <a href="https://stackoverflow.com/questions/60131900/weird-is-xhr-error-when-deploying-flask-app-to-heroku" rel="nofollow">https://stackoverflow.com/questions/60131900/weird-is-xhr-error-when-deploying-flask-app-to-heroku</a> (which was viewed &gt; 600 times in a few days)</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Flask pulls a compatible version of Werkzeug</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Paste a minimal example that causes the problem."><pre class="notranslate"><span class="pl-c"># Paste a minimal example that causes the problem.</span></pre></div>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">flask currently requires Werkzeug &gt;= 0.15 but we recently noticed that some of our existing flask applications were broken. In fact we were (still) running flask 0.12.4 and as it is now it is pulling Werkzeug 1.0.0 which is incompatible (breaks at runtime).</p>
<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="File &quot;/app/server/controller.py&quot;, line 24, in get_kws 2020-02-08T22:31:05.893850+00:00 app[web.1]: 'query_results': query_result 2020-02-08T22:31:05.893850+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/flask/json.py&quot;, line 298, in jsonify 2020-02-08T22:31:05.893851+00:00 app[web.1]: if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr: 2020-02-08T22:31:05.893851+00:00 app[web.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/werkzeug/local.py&quot;, line 347, in getattr 2020-02-08T22:31:05.893852+00:00 app[web.1]: return getattr(self._get_current_object(), name) 2020-02-08T22:31:05.893858+00:00 app[web.1]: AttributeError: 'Request' object has no attribute 'is_xhr'"><pre class="notranslate">File "/app/server/controller.py", line 24, in get_kws 2020-02-08T22:31:05.893850+00:00 app[web.1]: 'query_results': query_result 2020-02-08T22:31:05.893850+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/json.py", line 298, in jsonify 2020-02-08T22:31:05.893851+00:00 app[web.1]: if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr: 2020-02-08T22:31:05.893851+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/werkzeug/local.py", line 347, in getattr 2020-02-08T22:31:05.893852+00:00 app[web.1]: return getattr(self._get_current_object(), name) 2020-02-08T22:31:05.893858+00:00 app[web.1]: AttributeError: 'Request' object has no attribute 'is_xhr'</pre></div>
<p dir="auto">As described in the SO post, upgrading flask &gt;= 1.0 fixes this but I thought I'd still report this in case you think its worth releasing a 0.12.5, I could do the change in setup.py.</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Python version: 3.8</li>
<li>Flask version: 0.12.4</li>
<li>Werkzeug version: 1.0</li>
</ul>
<p dir="auto">In <a href="http://flask.pocoo.org" rel="nofollow">http://flask.pocoo.org</a>, "feedback website" link is 404 page.</p>
<p dir="auto"><a href="http://feedback.flask.pocoo.org/" rel="nofollow">http://feedback.flask.pocoo.org/</a></p>