@middy/secrets-manager 5.2.0 → 5.2.2

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.
Files changed (2) hide show
  1. package/index.js +15 -13
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -6,7 +6,8 @@ import {
6
6
  getInternal,
7
7
  processCache,
8
8
  modifyCache,
9
- jsonSafeParse
9
+ jsonSafeParse,
10
+ catchInvalidSignatureException
10
11
  } from '@middy/util'
11
12
  import {
12
13
  SecretsManagerClient,
@@ -43,12 +44,12 @@ const secretsManagerMiddleware = (opts = {}) => {
43
44
  options.fetchRotationDate === true ||
44
45
  options.fetchRotationDate?.[internalKey]
45
46
  ) {
47
+ const command = new DescribeSecretCommand({
48
+ SecretId: options.fetchData[internalKey]
49
+ })
46
50
  return client
47
- .send(
48
- new DescribeSecretCommand({
49
- SecretId: options.fetchData[internalKey]
50
- })
51
- )
51
+ .send(command)
52
+ .catch((e) => catchInvalidSignatureException(e, client, command))
52
53
  .then((resp) => {
53
54
  if (options.cacheExpiry < 0) {
54
55
  options.cacheKeyExpiry[internalKey] =
@@ -64,13 +65,14 @@ const secretsManagerMiddleware = (opts = {}) => {
64
65
  })
65
66
  }
66
67
  })
67
- .then(() =>
68
- client.send(
69
- new GetSecretValueCommand({
70
- SecretId: options.fetchData[internalKey]
71
- })
72
- )
73
- )
68
+ .then(() => {
69
+ const command = new GetSecretValueCommand({
70
+ SecretId: options.fetchData[internalKey]
71
+ })
72
+ return client
73
+ .send(command)
74
+ .catch((e) => catchInvalidSignatureException(e, client, command))
75
+ })
74
76
  .then((resp) => jsonSafeParse(resp.SecretString))
75
77
  .catch((e) => {
76
78
  const value = getCache(options.cacheKey).value ?? {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/secrets-manager",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "Secrets Manager middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -58,13 +58,13 @@
58
58
  "url": "https://github.com/sponsors/willfarrell"
59
59
  },
60
60
  "dependencies": {
61
- "@middy/util": "5.2.0"
61
+ "@middy/util": "5.2.2"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@aws-sdk/client-secrets-manager": "^3.0.0",
65
- "@middy/core": "5.2.0",
65
+ "@middy/core": "5.2.2",
66
66
  "@types/aws-lambda": "^8.10.101",
67
67
  "aws-xray-sdk": "^3.3.3"
68
68
  },
69
- "gitHead": "2d9096a49cd8fb62359517be96d6c93609df41f0"
69
+ "gitHead": "dbfe56d5dfc783fae1e19c7dddd074c0d18d5073"
70
70
  }