Skip to content
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

getting CSRF token issue while loading the superset using docker-compose #25079

Closed
nk8291 opened this issue Aug 24, 2023 · 8 comments
Closed

Comments

@nk8291
Copy link

nk8291 commented Aug 24, 2023

Dear Team,

I am trying to setup the superset on centos server.

Below is the configurations and tools available on server:

python 3.7
postgresql 14

used below command to setup superset:

git clone https://github.com/apache/superset.git
cd superset
docker-compose -f docker-compose-non-dev.yml pull
docker-compose -f docker-compose-non-dev.yml up

now when I try to login to superset url using admin / admin getting below error in terminal:

********************************************************** ERROR *************************************************
superset_app | Traceback (most recent call last):
superset_app | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in full_dispatch_request
superset_app | rv = self.preprocess_request()
superset_app | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2313, in preprocess_request
superset_app | rv = self.ensure_sync(before_func)()
superset_app | File "/usr/local/lib/python3.9/site-packages/flask_wtf/csrf.py", line 229, in csrf_protect
superset_app | self.protect()
superset_app | File "/usr/local/lib/python3.9/site-packages/flask_wtf/csrf.py", line 264, in protect
superset_app | self._error_response(e.args[0])
superset_app | File "/usr/local/lib/python3.9/site-packages/flask_wtf/csrf.py", line 307, in _error_response
superset_app | raise CSRFError(reason)
superset_app | flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF session token is missing.
superset_app | Loaded your LOCAL configuration at [/app/docker/pythonpath_dev/superset_config.py]
superset_app | 174.112.226.87 - - [24/Aug/2023:20:31:13 +0000] "POST /login/ HTTP/1.1" 302 201 "http://20.246.16.88:8088/login/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
superset_app | Unable to load SQLAlchemy dialect <class 'pydruid.db.sqlalchemy.DruidHTTPSDialect'>: No module named 'google'
superset_app | 2023-08-24 20:31:13,406:WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect <class 'pydruid.db.sqlalchemy.DruidHTTPSDialect'>: No module named 'google'


image

can someone assist in fixing this issues and understanding the root cause of the same.

@luongdolong
Copy link

@nk8291 I got the same error as you

@michael-s-molina
Copy link
Member

Hi @nk8291. You're using the master version of Superset which requires Python 3.9. You can check the dependencies in setup.py file.

If you're interested in using Superset for production environments, I recommend using an official release. The latest one is 2.1.0 (2.1.1 and 3.0.0 are almost out). You can follow this guide to do a docker compose using a specific tag.

@KSPT-taylorjohn
Copy link
Contributor

Hi @michael-s-molina , I believe @nk8291 mistakenly wrote that it is python 3.7 . He's running in docker and you see in the logs it is /usr/local/lib/python3.9.

I had the same problem running in docker and setting TALISMAN_ENABLED = False in superset_config.py is what worked for me.
I don't know the root cause.

@michael-s-molina
Copy link
Member

Hi @michael-s-molina , I believe @nk8291 mistakenly wrote that it is python 3.7 . He's running in docker and you see in the logs it is /usr/local/lib/python3.9.

Thank you @KSPT-taylorjohn for the eagle eyes!

I had the same problem running in docker and setting TALISMAN_ENABLED = False in superset_config.py is what worked for me.

@nk8291 I still recommend using an official release for production environments. If you do want to use the master version, @KSPT-taylorjohn's suggestion might be the solution. See #24579.

@anantmulchandani
Copy link

anantmulchandani commented Aug 29, 2023

Hi @michael-s-molina , I believe @nk8291 mistakenly wrote that it is python 3.7 . He's running in docker and you see in the logs it is /usr/local/lib/python3.9.

I had the same problem running in docker and setting TALISMAN_ENABLED = False in superset_config.py is what worked for me. I don't know the root cause.

Hi @KSPT-taylorjohn
I checked the boolean 'TALISMAN_ENABLED' in the Superset application container using the following commands:
docker exec -it <superset_app's Container ID> /bin/bash
superset shell
>>> from flask import current_app; print(current_app.config["TALISMAN_ENABLED"])

This gave the value of TALISMAN_ENABLED as False. Yet I face the same above issue.
Can anyone please help in this regard?

@nk8291
Copy link
Author

nk8291 commented Aug 29, 2023

Hi, the issue is fixed.

I have updated below step in yml file to provide the stable superset container image, which 2.1

x-superset-image: &superset-image apache/superset:2.1.0

image

@sfirke
Copy link
Member

sfirke commented Nov 14, 2023

Given that this discussion has some false starts like the Python version, the original poster had their issue fixed, and CSRF token problems are discussed in other issues, I'm going to close this. People have problems with CSRF tokens might want to review the posts under #24579.

@sfirke sfirke closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2023
@musicmuthu
Copy link

i have same error in 3.1.1

Unable to load SQLAlchemy dialect <class 'pydruid.db.sqlalchemy.DruidHTTPSDialect'>: No module named 'google'
2024-04-30 14:57:22,628:WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect <class 'pydruid.db.sqlalchemy.DruidHTTPSDialect'>: No module named 'google

bootstrapScript: |
#!/bin/bash
rm -rf /var/lib/apt/lists/* &&
pip install authlib==1.0.1
psycopg2==2.8.5 elasticsearch-dbapi==0.2.9 trino==0.321.0 cx_Oracle==8.3.0 gevent &&
if [ ! -f ~/bootstrap ]; then echo "Running Superset with uid 0" > ~/bootstrap; fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants