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

ResourceOwnerPasswordCredentials(app) fails with Unknown option config_prefix error #30

Open
cchayden opened this issue Aug 16, 2018 · 3 comments

Comments

@cchayden
Copy link

In pymongo 3.7.1 the MongoClient no longer accepts a keyword parameter config_prefix. This causes a failure when executing
ResourceOwnerPasswordCredentials(app)
I am not sure whether pymongo has a replacement for this functionality, but in any case it causes the whole system to not start up.

I subclassed ResourceOwnerPasswordCredentials and modified the init_app method to omit that parameter. Is there a more elegant solution?

Here is the stack trace:

Traceback (most recent call last):
  File "/home/cchayden/workspaces/mda/api/auth/run.py", line 56, in <module>
    ResourceOwnerPasswordCredentials(app)
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/flask_sentinel/flask_sentinel.py", line 22, in __init__
    self.init_app(app)
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/flask_sentinel/flask_sentinel.py", line 44, in init_app
    mongo.init_app(app, config_prefix='SENTINEL_MONGO')
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/flask_pymongo/__init__.py", line 160, in init_app
    self.cx = MongoClient(*args, **kwargs)
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/pymongo/mongo_client.py", line 521, in __init__
    for k, v in keyword_opts.items())
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/pymongo/mongo_client.py", line 521, in <genexpr>
    for k, v in keyword_opts.items())
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/pymongo/common.py", line 600, in validate
    value = validator(option, value)
  File "/home/cchayden/.virtualenvs/mongo/lib/python3.5/site-packages/pymongo/common.py", line 129, in raise_config_error
    raise ConfigurationError("Unknown option %s" % (key,))
pymongo.errors.ConfigurationError: Unknown option config_prefix

@caiohsramos
Copy link

I was having the same issue... Apparently it has something to do with the flask-pymongo version that is not compatible with Eve's most recent version. I fixed it by running:

pip install flask-pymongo==0.5.2

@rmlopes
Copy link

rmlopes commented Apr 29, 2019

pip install flask-pymongo==0.5.2

Also, werkzeug must be < 0.14.1 and Redis < 3.

@samsantiago
Copy link

Trying to upgrade/use Eve 0.9.2 and I see the same issue currently. Any recent information what versions are currently needed for flask-sentinel to work with Eve 0.9.2 for flask-pymongo, werkzeug and Redis?

Traceback (most recent call last):
File "run.py", line 39, in
ResourceOwnerPasswordCredentials(app)
File "/usr/local/lib/python3.7/site-packages/flask_sentinel/flask_sentinel.py", line 22, in init
self.init_app(app)
File "/usr/local/lib/python3.7/site-packages/flask_sentinel/flask_sentinel.py", line 44, in init_app
mongo.init_app(app, config_prefix='SENTINEL_MONGO')
File "/usr/local/lib/python3.7/site-packages/flask_pymongo/init.py", line 154, in init_app
self.cx = MongoClient(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pymongo/mongo_client.py", line 647, in init
dict(common.validate(k, v) for k, v in keyword_opts.items()))
File "/usr/local/lib/python3.7/site-packages/pymongo/mongo_client.py", line 647, in
dict(common.validate(k, v) for k, v in keyword_opts.items()))
File "/usr/local/lib/python3.7/site-packages/pymongo/common.py", line 725, in validate
value = validator(option, value)
File "/usr/local/lib/python3.7/site-packages/pymongo/common.py", line 143, in raise_config_error
raise ConfigurationError("Unknown option %s" % (key,))

pymongo.errors.ConfigurationError: Unknown option config_prefix

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

4 participants