Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Heads up about breaking change in library used by Flask

I  just added a couple of lines to the robots.txt of my app and when deployed the new version of the app to have this change updated live, the application failed to load with an error that looks like this:

... 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/__init__.py", line 7, in <module> from .app import Flask as Flask File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 27, in <module> from . import cli File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/cli.py", line 17, in <module> from .helpers import get_debug_flag File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/helpers.py", line 14, in <module> from werkzeug.urls import url_quote ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/urls.py)"

The solution was to add Werkzeug==2.3.7 to the requirements.txt as explained here.

I'm surprised no one has reported this yet, but it was kind of a scary that, basically, just by deploying your app again it broke 😥

 

 

Solved Solved
1 1 3,602
1 ACCEPTED SOLUTION

Thank you for raising this. I will surely include this information in the buganizer. 

View solution in original post

1 REPLY 1

Thank you for raising this. I will surely include this information in the buganizer.