@aws-sdk/credential-provider-http 3.972.41 → 3.972.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,11 +46,9 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
46
46
  }
47
47
  const url = new URL(host);
48
48
  (0, checkUrl_1.checkUrl)(url, options.logger);
49
- const requestHandler = node_http_handler_1.NodeHttpHandler.create({
50
- requestTimeout: options.timeout ?? 1000,
51
- connectionTimeout: options.timeout ?? 1000,
52
- });
53
- return (0, retry_wrapper_1.retryWrapper)(async () => {
49
+ const requestHandler = node_http_handler_1.NodeHttpHandler.create({ connectionTimeout: options.timeout ?? 1000 });
50
+ const requestTimeout = options.timeout ?? 1000;
51
+ const provider = (0, retry_wrapper_1.retryWrapper)(async () => {
54
52
  const request = (0, requestHelpers_1.createGetRequest)(url);
55
53
  if (token) {
56
54
  request.headers.Authorization = token;
@@ -59,12 +57,20 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
59
57
  request.headers.Authorization = (await promises_1.default.readFile(tokenFile)).toString();
60
58
  }
61
59
  try {
62
- const result = await requestHandler.handle(request);
60
+ const result = await requestHandler.handle(request, { requestTimeout });
63
61
  return (0, requestHelpers_1.getCredentials)(result.response).then((creds) => (0, client_1.setCredentialFeature)(creds, "CREDENTIALS_HTTP", "z"));
64
62
  }
65
63
  catch (e) {
66
64
  throw new config_1.CredentialsProviderError(String(e), { logger: options.logger });
67
65
  }
68
66
  }, options.maxRetries ?? 3, options.timeout ?? 1000);
67
+ return async () => {
68
+ try {
69
+ return await provider();
70
+ }
71
+ finally {
72
+ requestHandler.destroy?.();
73
+ }
74
+ };
69
75
  };
70
76
  exports.fromHttp = fromHttp;
@@ -42,11 +42,9 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
42
42
  }
43
43
  const url = new URL(host);
44
44
  checkUrl(url, options.logger);
45
- const requestHandler = NodeHttpHandler.create({
46
- requestTimeout: options.timeout ?? 1000,
47
- connectionTimeout: options.timeout ?? 1000,
48
- });
49
- return retryWrapper(async () => {
45
+ const requestHandler = NodeHttpHandler.create({ connectionTimeout: options.timeout ?? 1000 });
46
+ const requestTimeout = options.timeout ?? 1000;
47
+ const provider = retryWrapper(async () => {
50
48
  const request = createGetRequest(url);
51
49
  if (token) {
52
50
  request.headers.Authorization = token;
@@ -55,11 +53,19 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
55
53
  request.headers.Authorization = (await fs.readFile(tokenFile)).toString();
56
54
  }
57
55
  try {
58
- const result = await requestHandler.handle(request);
56
+ const result = await requestHandler.handle(request, { requestTimeout });
59
57
  return getCredentials(result.response).then((creds) => setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
60
58
  }
61
59
  catch (e) {
62
60
  throw new CredentialsProviderError(String(e), { logger: options.logger });
63
61
  }
64
62
  }, options.maxRetries ?? 3, options.timeout ?? 1000);
63
+ return async () => {
64
+ try {
65
+ return await provider();
66
+ }
67
+ finally {
68
+ requestHandler.destroy?.();
69
+ }
70
+ };
65
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-http",
3
- "version": "3.972.41",
3
+ "version": "3.972.43",
4
4
  "description": "AWS credential provider for containers and HTTP sources",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -23,6 +23,7 @@
23
23
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
24
24
  "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
25
25
  "test": "yarn g:vitest run",
26
+ "test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
26
27
  "test:watch": "yarn g:vitest watch"
27
28
  },
28
29
  "keywords": [
@@ -36,11 +37,11 @@
36
37
  },
37
38
  "license": "Apache-2.0",
38
39
  "dependencies": {
39
- "@aws-sdk/core": "^3.974.13",
40
+ "@aws-sdk/core": "^3.974.15",
40
41
  "@aws-sdk/types": "^3.973.9",
41
- "@smithy/core": "^3.24.3",
42
- "@smithy/fetch-http-handler": "^5.4.3",
43
- "@smithy/node-http-handler": "^4.7.3",
42
+ "@smithy/core": "^3.24.5",
43
+ "@smithy/fetch-http-handler": "^5.4.5",
44
+ "@smithy/node-http-handler": "^4.7.5",
44
45
  "@smithy/types": "^4.14.2",
45
46
  "tslib": "^2.6.2"
46
47
  },