ibm-functions / iam-token-manager-nodejs Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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.
npm WARN notsup Unsupported engine for @ibm-functions/[email protected]: wanted: {"node":"^12.x","npm":"6.4.1"} (current: {"node":"12.17.0","npm":"6.14.4"})
Why does the engine:
field have npm: 6.4.1
exactly? Seems like it should be npm: ^6.x
or unspecified.
Currently, the token manager uses the refreshToken to obtain a new access token, in case the access token has been expired. This may lead to unforeseen issues, if the refresh token expired as well. There is logic in place that should handle this case, but we do have the indication that the mechanism does not work properly.
The token manager should in all cases use the API key to obtain a new access token.
The Readme shows getToken()
instead of getAuthHeader
in the example
For containers API, they require the refresh_token to be sent at the header. For some of its API.
Refer:
https://containers.cloud.ibm.com/global/swagger-global-api/#/clusters/GetClusterConfig
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.