'list' object has no attribute 'middlewares'
See original GitHub issueThe following code raises the above error.
def auth_middleware(resolver, obj, info, **kwargs):
value = resolver(obj, info, **kwargs)
return value
@graphql_api.route('/graphql', methods=["POST"])
def graphql_server():
success, result = graphql_sync(
schema,
request.json,
middleware=[auth_middleware]
)
I think this is causing the issue: https://github.com/mirumee/ariadne/blob/2d2184939bf469f3a607bf3e08f2f27ca0fa7421/ariadne/extensions.py#L29-L30
Looks like the documentation isn’t up to date or wrong since this is expecting an MiddlewareManager
but the documentation shows a plain list. Or am I getting something wrong here?
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
'list' object has no attribute 'lower' in django - Stack Overflow
How to solve Exception Value: 'list' object has no attribute 'lower' in django - Stack Overflow. Stack Overflow for Teams – Start collaborating ......
Read more >2567 (cache_page works as wrapper function, not as decorator)
Do you have any request-altering middleware in place? It looks like the request object is not a class instance, but a function instead,...
Read more >Ansible dict object has no attribute stdout (or) stderr
This error appears when you are trying to iterate through a list or dictionary incorrectly. In this post, we will discuss how to...
Read more >web3.py - AttributeError: 'list' object has no attribute 'sign'
AttributeError: 'list' object has no attribute 'sign'. Thanks: from web3 import Web3 from web3.middleware import geth_poa_middleware matic ...
Read more >WSGIRequest' object has no attribute 'session'-django
If you came here because you updated to Django 2.0 and get this error, you might want to know that name MIDDLEWARE_CLASSES was...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Mhhh. So now I’m passing in
MiddlewareManager([auth_middleware])
tographql_sync
, the error is gone but the middleware never gets called.Edit: It looks like it has to be called like this,
MiddlewareManager(auth_middleware, another_middleware, ...)
I’ve decided to re-do middlewares starting with Ariadne 0.17.
middlewares
option will now be:None
None
or list of middlewaresIf you need custom middleware manager, it will be passable as
middleware_manager_class
option.