-
Notifications
You must be signed in to change notification settings - Fork 597
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
AbortSignal Timeout is only used for the actual request, not all middleware calls #5810
Comments
Hi @Llois41 , I'm not able to reproduce the reported behavior. When running your code I see the request being aborted immediately: $ node sample.mjs
/Users/rvaknin/test_folder/5810/node_modules/@smithy/node-http-handler/dist-cjs/index.js:249
const abortError = new Error("Request aborted");
^
Error [AbortError]: Request aborted
at /Users/rvaknin/test_folder/5810/node_modules/@smithy/node-http-handler/dist-cjs/index.js:249:28
at new Promise (<anonymous>)
at _NodeHttpHandler.handle (/Users/rvaknin/test_folder/5810/node_modules/@smithy/node-http-handler/dist-cjs/index.js:234:12)
at async /Users/rvaknin/test_folder/5810/node_modules/@smithy/middleware-serde/dist-cjs/index.js:33:24
at async /Users/rvaknin/test_folder/5810/node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js:192:18
at async /Users/rvaknin/test_folder/5810/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
at async /Users/rvaknin/test_folder/5810/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
at async file:///Users/rvaknin/test_folder/5810/sample.mjs:16:1 {
'$metadata': { attempts: 1, totalRetryDelay: 0 }
}
Node.js v18.13.0
$ npm ls
5810@1.0.0 /Users/rvaknin/test_folder/5810
└── @aws-sdk/client-kms@3.511.0 I'm not quite sure why you are seeing this behavior. Any chance you can create a small git repo and share it was so I could clone and further look into it? Thanks, |
@RanVaknin Hi, thanks for your answer. Did you check that the STS call before the KMS call really was made? We observed that there is some sort of caching or disable mechanism preventing it from happening. Also I do not see the log that the STS request started in your output. |
Hi @Llois41 , Thanks for re-iterating this. After re-reading this I think I understand the problem. I'll discuss this with the team to see if this can be added. Thanks again, |
@Llois41 the fix for correcting the default STS region was released in v3.515.0 of all SDK clients including KMS. If you can take up the fix, do you still need AbortSignal access to the inner STS client? If explicitly using a credential provider, an inner client config can also be passed that sets a requestTimeout on the inner client's requestHandler. |
@kuhe Yes we would still appreciate the fix since we do not explicitly configure a credential provider, STS seems to be the default. It would make sense to pass the AbortSignal down since always something can go wrong (connection issues can have so many reasons) which would cause the KMS call to hang until connection timeouts occur. |
Using https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.524.0, that is version v3.524.0 of the client, you can set a timeout on the STS request like this: import { KmsClient } from '@aws-sdk/client-kms';
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
const client = new KmsClient({
credentials: fromNodeProviderChain({
clientConfig: {
requestHandler: {
requestTimeout: 1_000,
connectionTimeout: 1_000,
}
}
});
}); The |
@kuhe Thanks for the code example. Is there any description of this behaviour in the docs (i.e. the differnece between We would appreciate if the API would allow only one mechanism. :) |
Checkboxes for prior research
Describe the bug
After upgrading the
@aws-sdk/client-kms
package from 3.478.0 to 3.511.0 we started seeing STS calls to the wrong region as stated in #5799.We call the
send()
-Method like following:We were surprised that the configured one second
abortSignal
timeout was not honored for calls to STS endpoints (which were dramatically slower due to #5799).SDK version number
@aws-sdk/client-kms@3.511.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.19.1
Reproduction Steps
run following snippet
Observed Behavior
A request to STS is made but does not honor the AbortSignal timeout (1ms). Instead it takes 64ms (finishes the call to STS and then applies the AbortSignal timeout):
Expected Behavior
KMSClient should use the provided AbortSignal timeout for all operations.
Possible Solution
No response
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: