Skip to content

flask_oauthlib doesn't load properly #9419

Closed
@johnseekins

Description

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".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    inactiveInactive for >= 30 days

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions