You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "ylq5126 (via GitHub)" <gi...@apache.org> on 2024/07/25 02:36:49 UTC
[I] cannot use a string pattern on a bytes-like object [superset]
ylq5126 opened a new issue, #29695:
URL: https://github.com/apache/superset/issues/29695
### 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
https://github.com/pallets/werkzeug/issues/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
- [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [ ] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #29695: cannot use a string pattern on a bytes-like object
URL: https://github.com/apache/superset/issues/29695
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29695:
URL: https://github.com/apache/superset/issues/29695#issuecomment-2442521317
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 :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "patheard (via GitHub)" <gi...@apache.org>.
patheard commented on issue #29695:
URL: https://github.com/apache/superset/issues/29695#issuecomment-2442451885
Confirmed this fixed for us as well on v4.0.2.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "meghana1911 (via GitHub)" <gi...@apache.org>.
meghana1911 commented on issue #29695:
URL: https://github.com/apache/superset/issues/29695#issuecomment-2271784759
@ylq5126 Did this work for you. What changes did you make?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "ylq5126 (via GitHub)" <gi...@apache.org>.
ylq5126 commented on issue #29695:
URL: https://github.com/apache/superset/issues/29695#issuecomment-2272484565
> @ylq5126 Did this work for you. What changes did you make?
pip install flask-session==0.8.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "ylq5126 (via GitHub)" <gi...@apache.org>.
ylq5126 commented on issue #29695:
URL: https://github.com/apache/superset/issues/29695#issuecomment-2272484937
> @ylq5126 Did this work for you. What changes did you make?
update version to 4.1.x
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] cannot use a string pattern on a bytes-like object [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29695:
URL: https://github.com/apache/superset/issues/29695#issuecomment-2249253188
<!-- Greeting -->
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!
<!-- Answer -->
The `TypeError: cannot use a string pattern on a bytes-like object` error you're encountering is due to an incompatibility between Flask-Session 0.5.0 and Werkzeug 3.0.0. Flask-Session versions prior to 0.6.0 do not support Werkzeug 3.0.0, which causes this issue when setting cookies.
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 `requirements.txt` or `pyproject.toml` file to specify the newer version of Flask-Session.
Here is an example of how you can update your `requirements.txt`:
```plaintext
Flask-Session>=0.6.0
```
Or if you are using `pyproject.toml`:
```toml
[tool.poetry.dependencies]
flask-session = ">=0.6.0"
```
After updating the dependency, make sure to reinstall the packages:
```bash
pip install -r requirements.txt
# or
poetry install
```
This should resolve the `TypeError` and allow your server to start correctly with Redis for session management <sup>[[1]](https://github.com/apache/superset/blob/master/pyproject.toml)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org