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

Cognito class instances talk to AWS at import time #47

Open
jordan-dimov opened this issue Jun 11, 2021 · 4 comments
Open

Cognito class instances talk to AWS at import time #47

jordan-dimov opened this issue Jun 11, 2021 · 4 comments
Labels
answered This issue is answered. wait for issuer's response

Comments

@jordan-dimov
Copy link

Because of code like jwks = JWKS.fromurl(url) in the __init__(), it is impossible to import modules without them trying to connect to AWS Cognito at import time. This can cause a variety of problems, e.g. - unable to run unit tests without an Internet connection.

@Minipada
Copy link

Hi @jordan-dimov I was following this issue as I am dealing with edge devices and this is definitely an issue at the moment.
Did you close because you found a workaround?
If so, could you share?

@jordan-dimov
Copy link
Author

@Minipada Oh, good to know it's not just me. I thought maybe I wasn't using it correctly. Ended up creating a fake Cognito class just for my unit tests, and switching between those with an environment variable. Happy to re-open this though.

@jordan-dimov jordan-dimov reopened this Jun 15, 2021
@tokusumi tokusumi added the answered This issue is answered. wait for issuer's response label Jan 2, 2022
@tivaliy
Copy link

tivaliy commented Jan 11, 2022

I've faced with the same issue trying to write unittests using moto to fake Cognito resources. And in my case there is no straightforward way to pre-configure environment variable, since I create AWS Cognito resources using fixtures (pytest). Any good ideas how to overcome this?

@deanq
Copy link

deanq commented Feb 2, 2023

I have faced the same issue and found a good solution mentioned on another issue here: #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered This issue is answered. wait for issuer's response
Projects
None yet
Development

No branches or pull requests

5 participants