-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
cannot use a string pattern on a bytes-like object #29695
Comments
Hey @ylq5126! I'm here to help you out with any bugs, questions, or contributions you might have. Let's work together to solve this issue! The To resolve this, you should upgrade Flask-Session to at least version 0.6.0, which includes support for Werkzeug 3.0.0. You can do this by updating your Here is an example of how you can update your
Or if you are using [tool.poetry.dependencies]
flask-session = ">=0.6.0" After updating the dependency, make sure to reinstall the packages: pip install -r requirements.txt
# or
poetry install This should resolve the |
@ylq5126 Did this work for you. What changes did you make? |
|
update version to 4.1.x |
Confirmed this fixed for us as well on v4.0.2. |
Sounds like this is solved for 4.0 and 4.1, so I'll go ahead and close this out. Please let me know if I've misjudged and I/we can reopen it :) |
Bug description
use redis to store session, server not start current
How to reproduce the bug
from docker file 4.0.2-dev
config use
SESSION_SERVER_SIDE = True
SESSION_TYPE = "redis"
SESSION_REDIS = Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_SESSION_DB, password=REDIS_PASS, charset="utf-8")
in docker flask-session is 0.5.0
Screenshots/recordings
superset-prod-01 | Exception on / [GET]
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
superset-prod-01 | response = self.full_dispatch_request()
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1826, in full_dispatch_request
superset-prod-01 | return self.finalize_request(rv)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1847, in finalize_request
superset-prod-01 | response = self.process_response(response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2344, in process_response
superset-prod-01 | self.session_interface.save_session(self, ctx.session, response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
superset-prod-01 | response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
superset-prod-01 | dump_cookie(
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
superset-prod-01 | if not _cookie_no_quote_re.fullmatch(value):
superset-prod-01 | TypeError: cannot use a string pattern on a bytes-like object
superset-prod-01 | 2024-07-17 12:20:45,421:ERROR:superset.app:Exception on / [GET]
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
superset-prod-01 | response = self.full_dispatch_request()
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1826, in full_dispatch_request
superset-prod-01 | return self.finalize_request(rv)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1847, in finalize_request
superset-prod-01 | response = self.process_response(response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2344, in process_response
superset-prod-01 | self.session_interface.save_session(self, ctx.session, response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
superset-prod-01 | response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
superset-prod-01 | dump_cookie(
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
superset-prod-01 | if not _cookie_no_quote_re.fullmatch(value):
superset-prod-01 | TypeError: cannot use a string pattern on a bytes-like object
superset-prod-01 | Request finalizing failed with an error while handling an error
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
superset-prod-01 | response = self.full_dispatch_request()
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1826, in full_dispatch_request
superset-prod-01 | return self.finalize_request(rv)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1847, in finalize_request
superset-prod-01 | response = self.process_response(response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2344, in process_response
superset-prod-01 | self.session_interface.save_session(self, ctx.session, response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
superset-prod-01 | response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
superset-prod-01 | dump_cookie(
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
superset-prod-01 | if not _cookie_no_quote_re.fullmatch(value):
superset-prod-01 | TypeError: cannot use a string pattern on a bytes-like object
superset-prod-01 |
superset-prod-01 | During handling of the above exception, another exception occurred:
superset-prod-01 |
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1847, in finalize_request
superset-prod-01 | response = self.process_response(response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2344, in process_response
superset-prod-01 | self.session_interface.save_session(self, ctx.session, response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
superset-prod-01 | response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
superset-prod-01 | dump_cookie(
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
superset-prod-01 | if not _cookie_no_quote_re.fullmatch(value):
superset-prod-01 | TypeError: cannot use a string pattern on a bytes-like object
superset-prod-01 | 2024-07-17 12:20:45,423:ERROR:superset.app:Request finalizing failed with an error while handling an error
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
superset-prod-01 | response = self.full_dispatch_request()
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1826, in full_dispatch_request
superset-prod-01 | return self.finalize_request(rv)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1847, in finalize_request
superset-prod-01 | response = self.process_response(response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2344, in process_response
superset-prod-01 | self.session_interface.save_session(self, ctx.session, response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
superset-prod-01 | response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
superset-prod-01 | dump_cookie(
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
superset-prod-01 | if not _cookie_no_quote_re.fullmatch(value):
superset-prod-01 | TypeError: cannot use a string pattern on a bytes-like object
superset-prod-01 |
superset-prod-01 | During handling of the above exception, another exception occurred:
superset-prod-01 |
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1847, in finalize_request
superset-prod-01 | response = self.process_response(response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2344, in process_response
superset-prod-01 | self.session_interface.save_session(self, ctx.session, response)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
superset-prod-01 | response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
superset-prod-01 | dump_cookie(
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
superset-prod-01 | if not _cookie_no_quote_re.fullmatch(value):
superset-prod-01 | TypeError: cannot use a string pattern on a bytes-like object
superset-prod-01 | 10.100.138.2 - - [17/Jul/2024:12:20:45 0000] "GET / HTTP/1.1" 500 332 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Superset version
4.0.2
Python version
3.9
Node version
16
Browser
Chrome
Additional context
from werkzeug issue
pallets/werkzeug#2795
from flask-session Changes
https://flask-session.readthedocs.io/en/latest/changes.html#id1
flask-session not supported werkzeug 3.0 when version less than 0.6.0
Checklist
The text was updated successfully, but these errors were encountered: