You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "iali9906 (via GitHub)" <gi...@apache.org> on 2024/07/17 12:09:49 UTC
[I] SECRET KEY ERROR [superset]
iali9906 opened a new issue, #29619:
URL: https://github.com/apache/superset/issues/29619
### Bug description
Hello,
I entered the variable 'SESSION_SERVER_SIDE = True ' and I encounter the following error:
```
superset-prod-01 | The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
superset-prod-01 | rv = self.dispatch_request()
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
superset-prod-01 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_oidc/views.py", line 47, in login_view
superset-prod-01 | session["next"] = request.args.get("next", request.root_url)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/sessions.py", line 98, in _fail
superset-prod-01 | raise RuntimeError(
superset-prod-01 | RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
superset-prod-01 | 2024-07-17 12:04:04,327:ERROR:superset.views.base:The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
superset-prod-01 | Traceback (most recent call last):
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
superset-prod-01 | rv = self.dispatch_request()
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
superset-prod-01 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask_oidc/views.py", line 47, in login_view
superset-prod-01 | session["next"] = request.args.get("next", request.root_url)
superset-prod-01 | File "/usr/local/lib/python3.9/site-packages/flask/sessions.py", line 98, in _fail
superset-prod-01 | raise RuntimeError(
superset-prod-01 | RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
```
in my superset_config.py I have the string SECRET_KEY = 'STRONGSTRING'
and logging into the shel with 'docker exec -en superset-prod-01 superset shell' and running the command “from flask import current_app; print(current_app.config[”SECRET_KEY“])” returns me the same string that I entered in superset_config.py
How can I solve it?
### How to reproduce the bug
1) add SESSION_SERVER_SIDE = True in superset_config.py
2) add secret key in superset_config.py
3) restart docker container
### Screenshots/recordings
_No response_
### Superset version
4.0.2
### Python version
I don't know
### Node version
I don't know
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] 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] SECRET KEY ERROR [superset]
Posted by "ylq5126 (via GitHub)" <gi...@apache.org>.
ylq5126 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2246817696
> The error "TypeError: cannot use a string pattern on a bytes-like object" indicates a mismatch between string and byte data types. To resolve this issue in your Superset application when using Redis for session management, ensure that the session data is properly encoded and decoded.
>
> Here's how you can adjust your `superset_config.py` to handle this:
>
> 1. **Ensure Proper Encoding and Decoding**:
> Make sure that any data being stored or retrieved from the session is properly encoded to bytes or decoded to strings as needed.
> ```python
> from redis import Redis
>
> SESSION_TYPE = "redis"
> SESSION_REDIS = Redis(host="superset-redis-prod-01", port=6379, db=0)
> SESSION_USE_SIGNER = True
> SESSION_COOKIE_SECURE = True
> SESSION_COOKIE_HTTPONLY = True
> SESSION_COOKIE_SAMESITE = "Lax"
>
> # Example of encoding and decoding session data
> def encode_data(data):
> return data.encode('utf-8') if isinstance(data, str) else data
>
> def decode_data(data):
> return data.decode('utf-8') if isinstance(data, bytes) else data
> ```
> 2. **Check Session Data Handling**:
> If you are manually handling session data, ensure that you encode strings to bytes before storing them in Redis and decode bytes to strings when retrieving them.
> ```python
> # Example usage
> session_data = "some string data"
> encoded_session_data = encode_data(session_data)
> # Store `encoded_session_data` in Redis
>
> # When retrieving
> retrieved_data = decode_data(encoded_session_data)
> ```
>
> By ensuring that the data types are correctly handled, you can avoid the "TypeError: cannot use a string pattern on a bytes-like object" error [[1]](https://github.com/apache/superset/blob/master/docs/docs/security/security.mdx).
>
> _To continue talking to [Dosu](https://dosu.dev), mention @dosu._
in docker 4.0.2-dev, werkzeug version not support bytes value
--
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] SECRET KEY ERROR [superset]
Posted by "ylq5126 (via GitHub)" <gi...@apache.org>.
ylq5126 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2249248606
from this issue , https://github.com/pallets/werkzeug/issues/2795
> 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"
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] SECRET KEY ERROR [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2233177910
<!-- Greeting -->
Hey @iali9906! I'm here to help you with this issue. I'm Dosu, a bot that can assist with bug resolutions, answer questions, and guide you to become a contributor. Let's tackle this together!
<!-- Answer -->
To resolve the issue of the session being unavailable due to no secret key being set, despite having `SECRET_KEY` defined in `superset_config.py` and encountering the error after setting `SESSION_SERVER_SIDE = True`, follow these steps:
1. **Ensure `SECRET_KEY` is properly set**:
Make sure your `SECRET_KEY` is not the default value and is set to a strong, unique string. You can generate a secure key using `openssl`:
```bash
openssl rand -base64 42
```
Update your `superset_config.py` with the generated key:
```python
# superset_config.py
SECRET_KEY = 'YOUR_GENERATED_SECRET_KEY'
```
2. **Verify `SESSION_SERVER_SIDE` configuration**:
Ensure that `SESSION_SERVER_SIDE` is set to `True` in your `superset_config.py`:
```python
# superset_config.py
SESSION_SERVER_SIDE = True
```
3. **Set up server-side session storage**:
If you are using server-side sessions, you need to configure a session backend. For example, using Redis:
```python
# superset_config.py
from redis import Redis
SESSION_TYPE = "redis"
SESSION_REDIS = Redis(host="localhost", port=6379, db=0)
# Sign the session cookie sid
SESSION_USE_SIGNER = True
```
4. **Environment variable for `SECRET_KEY`**:
Alternatively, you can set the `SECRET_KEY` using an environment variable to avoid hardcoding it in your configuration file:
```python
# superset_config.py
import os
SECRET_KEY = os.getenv('SUPERSET_SECRET_KEY', 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY')
```
Export the `SUPERSET_SECRET_KEY` environment variable before starting Superset:
```bash
export SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
```
By ensuring that the `SECRET_KEY` is securely set and not using the default value, and properly configuring the session backend, the session should be available, and the application should start without issues <sup>[[1]](https://github.com/apache/superset/blob/master/superset/initialization/__init__.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/docs/docs/security/security.mdx)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset/config.py)</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
Re: [I] SECRET KEY ERROR [superset]
Posted by "iali9906 (via GitHub)" <gi...@apache.org>.
iali9906 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2233264817
@dosu
`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:58:12,006: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:58:12,010: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:58:12 +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-prod-01 | Exception on /health [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:58:20,239:ERROR:superset.app:Exception on /health [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:58:20,240: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 | 127.0.0.1 - - [17/Jul/2024:12:58:20 +0000] "GET /health HTTP/1.1" 500 332 "-" "curl/7.88.1"`
--
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] SECRET KEY ERROR [superset]
Posted by "ylq5126 (via GitHub)" <gi...@apache.org>.
ylq5126 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2249250115
https://github.com/apache/superset/issues/29695
change werkzeug version to 2.3.8
or
update flask-session version to 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] SECRET KEY ERROR [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2233575513
<!-- Answer -->
The error "TypeError: cannot use a string pattern on a bytes-like object" indicates a mismatch between string and byte data types. To resolve this issue in your Superset application when using Redis for session management, ensure that the session data is properly encoded and decoded.
Here's how you can adjust your `superset_config.py` to handle this:
1. **Ensure Proper Encoding and Decoding**:
Make sure that any data being stored or retrieved from the session is properly encoded to bytes or decoded to strings as needed.
```python
from redis import Redis
SESSION_TYPE = "redis"
SESSION_REDIS = Redis(host="superset-redis-prod-01", port=6379, db=0)
SESSION_USE_SIGNER = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax"
# Example of encoding and decoding session data
def encode_data(data):
return data.encode('utf-8') if isinstance(data, str) else data
def decode_data(data):
return data.decode('utf-8') if isinstance(data, bytes) else data
```
2. **Check Session Data Handling**:
If you are manually handling session data, ensure that you encode strings to bytes before storing them in Redis and decode bytes to strings when retrieving them.
```python
# Example usage
session_data = "some string data"
encoded_session_data = encode_data(session_data)
# Store `encoded_session_data` in Redis
# When retrieving
retrieved_data = decode_data(encoded_session_data)
```
By ensuring that the data types are correctly handled, you can avoid the "TypeError: cannot use a string pattern on a bytes-like object" error <sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/security/security.mdx)</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
Re: [I] SECRET KEY ERROR [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-3068329387
Assuming from the silence that the dependency patches listed above worked, and all is well now. Correct me if i'm wrong, and I'll be happy to reopen.
--
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] SECRET KEY ERROR [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #29619: SECRET KEY ERROR
URL: https://github.com/apache/superset/issues/29619
--
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] SECRET KEY ERROR [superset]
Posted by "ylq5126 (via GitHub)" <gi...@apache.org>.
ylq5126 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2246816660
> Hi @dosu now i set this value, but i have another errors:
>
> SESSION_TYPE = "redis" SESSION_REDIS = Redis(host="superset-redis-prod-01", port=6379, db=0) SESSION_USE_SIGNER = True SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_SAMESITE = "Lax"
>
> ```
>
> 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"
> ```
in docker change Werkzeug version to 2.3.8, it works fine
pip install werkzeug==2.3.8
--
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] SECRET KEY ERROR [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2776819319
Is anyone still facing this, particularly in 4.1.2 or newer? It's been slient for > 200 days. Hopefully [this](https://github.com/apache/superset/issues/29619#issuecomment-2249250115) solved things?
--
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] SECRET KEY ERROR [superset]
Posted by "meghana1911 (via GitHub)" <gi...@apache.org>.
meghana1911 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2264143236
I'm facing the exact list of errors above. Were you able to solve this? @iali9906
--
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] SECRET KEY ERROR [superset]
Posted by "iali9906 (via GitHub)" <gi...@apache.org>.
iali9906 commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2233198357
Hi @dosu now i set this value, but i have another errors:
SESSION_TYPE = "redis"
SESSION_REDIS = Redis(host="superset-redis-prod-01", port=6379, db=0)
SESSION_USE_SIGNER = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax"
```
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"
```
--
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] SECRET KEY ERROR [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29619:
URL: https://github.com/apache/superset/issues/29619#issuecomment-2233252271
<!-- Answer -->
The error "TypeError: cannot use a string pattern on a bytes-like object" typically occurs due to a mismatch between string and byte data types. To resolve this issue in your Superset application when using Redis for session management, ensure that the session data is properly encoded and decoded.
Here's how you can adjust your `superset_config.py` to handle this:
1. **Ensure Proper Encoding and Decoding**:
Make sure that any data being stored or retrieved from the session is properly encoded to bytes or decoded to strings as needed.
```python
from redis import Redis
SESSION_TYPE = "redis"
SESSION_REDIS = Redis(host="superset-redis-prod-01", port=6379, db=0)
SESSION_USE_SIGNER = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax"
# Example of encoding and decoding session data
def encode_data(data):
return data.encode('utf-8') if isinstance(data, str) else data
def decode_data(data):
return data.decode('utf-8') if isinstance(data, bytes) else data
```
2. **Check Session Data Handling**:
If you are manually handling session data, ensure that you encode strings to bytes before storing them in Redis and decode bytes to strings when retrieving them.
```python
# Example usage
session_data = "some string data"
encoded_session_data = encode_data(session_data)
# Store `encoded_session_data` in Redis
# When retrieving
retrieved_data = decode_data(encoded_session_data)
```
By ensuring that the data types are correctly handled, you can avoid the "TypeError: cannot use a string pattern on a bytes-like object" error <sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/security/security.mdx)</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