@middy/s3 5.2.0 → 5.2.1

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 +5 -2
  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 { S3Client, GetObjectCommand } from '@aws-sdk/client-s3'
12
13
  const defaults = {
@@ -31,8 +32,10 @@ const s3Middleware = (opts = {}) => {
31
32
  const values = {}
32
33
  for (const internalKey of Object.keys(options.fetchData)) {
33
34
  if (cachedValues[internalKey]) continue
35
+ const command = new GetObjectCommand(options.fetchData[internalKey])
34
36
  values[internalKey] = client
35
- .send(new GetObjectCommand(options.fetchData[internalKey]))
37
+ .send(command)
38
+ .catch((e) => catchInvalidSignatureException(e, client, command))
36
39
  .then(async (resp) => {
37
40
  let value = await resp.Body.transformToString()
38
41
  if (contentTypePattern.test(resp.ContentType)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/s3",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "S3 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.1"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@aws-sdk/client-s3": "^3.0.0",
65
- "@middy/core": "5.2.0",
65
+ "@middy/core": "5.2.1",
66
66
  "@types/aws-lambda": "^8.10.101",
67
67
  "aws-xray-sdk": "^3.3.3"
68
68
  },
69
- "gitHead": "2d9096a49cd8fb62359517be96d6c93609df41f0"
69
+ "gitHead": "4d55da221b9165b4b3e59a12632fd40a149a1e92"
70
70
  }