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

[Bug] Many 'concurrent' getAuthHeader() calls cause 429 response from IAM #12

Closed
ASEIDEL77 opened this issue Oct 6, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@ASEIDEL77
Copy link
Contributor

The OpenWhisk SDK uses the iam-token-manager package to plug in IAM token support as the default authHandler for openwhisk client instances that interact with IAM namespaces.

When customers try to invoke many actions from one other action, they inadvertently trigger a lot of getAuthHeader() calls on the iam-token-manager 'concurrently'. The word 'concurrently' is in quotation marks, as nodejs is single threaded, yet while the getToken() request is in-flight, all the other getAuthHeader() calls trigger many more (unnecessary) getToken() requests.

This leads to a 429 'Too many request' Denial of Service protection error from the IAM token API.

Therefore, the caching behavior for the tokenInfo (Token Request response JSON) and the logic for when to request another token needs to be improved.

For simple scenarios, the code is working just fine, so this issue could be considered an enhancement as well.

Fyi: I have some code that addresses this issue ready soon.

@ASEIDEL77 ASEIDEL77 added the bug Something isn't working label Oct 6, 2020
@ASEIDEL77
Copy link
Contributor Author

The code is here: https://github.com/ASEIDEL77/iam-token-manager-nodejs/tree/12_Enhance_tokenInfo_Caching_Behavior Still needs to be tested and verified. I'll open a PR, once that is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant