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

flask_oauthlib doesn't load properly #9419

Closed
3 tasks done
johnseekins opened this issue Mar 30, 2020 · 4 comments
Closed
3 tasks done

flask_oauthlib doesn't load properly #9419

johnseekins opened this issue Mar 30, 2020 · 4 comments
Labels
inactive Inactive for >= 30 days

Comments

@johnseekins
Copy link

johnseekins commented Mar 30, 2020

When trying to enable OAuth2 (with Okta) with superset (following documentation here: https://superset.incubator.apache.org/installation.html#custom-oauth2-configuration), the service fails to start.

Expected results

Superset starts up and can handle OAuth2 configs

Actual results

Mar 30 20:18:50 use1-superset-1 gunicorn[8851]: ImportError: cannot import name 'url_quote'
Mar 30 20:18:50 use1-superset-1 gunicorn[8851]: During handling of the above exception, another exception occurred:
Mar 30 20:18:50 use1-superset-1 gunicorn[8851]: Traceback (most recent call last):
Mar 30 20:18:50 use1-superset-1 gunicorn[8851]:   File "/datto/monitoring/superset/.pyenv/versions/3.6.8/lib/python3.6/site-packages/gunicorn/instrument/statsd.py", line 121, in _sock_send
Mar 30 20:18:50 use1-superset-1 gunicorn[8851]:     self.sock.send(msg)

How to reproduce the bug

  1. Install recent superset (0.35.2) (pip3 install apache-superset)
  2. install flask_oauthlib/authlib (pip3 install flask_oauthlib Authlib)
  3. Enable OAuth2 in Superset config:
from flask_appbuilder.security.manager import AUTH_OAUTH
AUTH_TYPE = AUTH_OAUTH
  1. See error

Environment

(please complete the following information):

  • superset version: 0.35.2
  • python version: 3.6.8
  • node.js version: ??
  • npm version: ???

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional Context

This is likely because Werkzeug updated to 1.0.0. From Werkzeug's changelog:
Remove most top-level attributes provided by the werkzeug module in favor of direct imports. For example, instead of import werkzeug; werkzeug.url_quote, do from werkzeug.urls import url_quote. Install version 0.16 first to see deprecation warnings while upgrading. #2, #1640

Rolling back the Werkzeug verzion fixes the bug:

Found existing installation: Werkzeug 1.0.0
Uninstalling Werkzeug-1.0.0:
  Would remove:
    /datto/monitoring/superset/.pyenv/versions/3.6.8/lib/python3.6/site-packages/Werkzeug-1.0.0.dist-info/*
    /datto/monitoring/superset/.pyenv/versions/3.6.8/lib/python3.6/site-packages/werkzeug/*
Proceed (y/n)? y
  Successfully uninstalled Werkzeug-1.0.0
root@use1-superset-1:/datto/monitoring/superset# .pyenv/versions/3.6.8/bin/pip install Werkzeug==0.16
Collecting Werkzeug==0.16
  Downloading Werkzeug-0.16.0-py2.py3-none-any.whl (327 kB)
     |████████████████████████████████| 327 kB 5.6 MB/s 
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.16.0

BTW, flask_oauthlib has a big banner on their page saying "You shouldn't use this module any more".

@stale
Copy link

stale bot commented May 30, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label May 30, 2020
@stale stale bot closed this as completed Jun 6, 2020
@ChiakaiChang
Copy link

I have this problem too when trying to use oauth2.
Could someone help ?

@hwhsu
Copy link

hwhsu commented Jun 10, 2020

@ChiakaiChang
You can try to add Flask_OAuthlib to requirements.txt and change the version of the werkzeug==1.0.1 -> werkzeug==0.16 then rebuild it.

@ChiakaiChang
Copy link

@hwhsu
It works. Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

3 participants