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

AuthenticationBackend - requires Failing with "IndexError: tuple index out of range" #567

Closed
mthipparthi opened this issue Jul 1, 2019 · 5 comments

Comments

@mthipparthi
Copy link

Issue: requires giving IndexError: tuple index out of range error.
reason : args will not present when we use synchronous decorators
Fix: args, idx wont be avilable in synchronous decorators, it should be removed from that check.

Test Code:
`
@router.post(
"/v1/ns/user-subscriptions", status_code=HTTP_201_CREATED, response_model=SubscriptionsResponse
)
@requires("authenticated")
def create_subscription(request: Request, l_request: SubscriptionsRequest):
# validate_auth_token(g_request)

service = SubscriptionService()
# service.user_id = get_user_id(g_request)
service.user_id = "12345"
service.create(l_request.dict())
return l_request.dict()

`

@cesarferradas
Copy link

@mthipparthi getting this error too, did you work around it or do you know if the Starlette maintainers will work on this? If you understand the issue enough to explain it to me, I can make a PR.

@ethan-fox-capsule
Copy link

@mthipparthi @cesarferradas Make it 3 ... im a little disheartened that I am coming across this issue months down the road and there doesn't seem to be a resolution. Short of copy-pasting the decorator and removing the .get default myself, is there a workaround for this?

@Kludex
Copy link
Sponsor Member

Kludex commented Dec 14, 2021

Is this issue still valid? Can someone confirm?

@cda2
Copy link

cda2 commented Dec 27, 2021

@Kludex Solved after using 0.17.1 version, which #1335 merged.
But when using old versions, still valid. (FastAPI in my case, using 0.16.0)

@Kludex
Copy link
Sponsor Member

Kludex commented Dec 27, 2021

Thanks :)

@Kludex Kludex closed this as completed Dec 27, 2021
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

5 participants