From e39a71d8631c9e203e1bcbcb1abdf6f0379fae14 Mon Sep 17 00:00:00 2001 From: Alex Hinson Date: Wed, 10 Feb 2021 14:43:12 -0800 Subject: [PATCH] chore: update to aws-sdk 3.4.1 (#7726) --- .circleci/config.yml | 9 +++----- .../bundle-size-action/webpack/package.json | 8 +++---- .../bundle-size-action/webpack4/package.json | 2 +- packages/analytics/package.json | 10 ++++---- .../src/Providers/AWSPinpointProvider.ts | 2 +- packages/core/package.json | 8 +++---- packages/interactions/package.json | 2 +- packages/predictions/package.json | 14 +++++------ packages/storage/package.json | 8 +++---- .../providers/AWSS3ProviderManagedUpload.ts | 23 +++++++++++++++++-- .../src/providers/axios-http-handler.ts | 4 ++-- 11 files changed, 53 insertions(+), 37 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 33b63a48422..2e138a68f2f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -885,8 +885,7 @@ workflows: - integ_react_predictions - integ_react_datastore - integ_react_storage - # Removing this until AWS SDK issue is resolved: https://github.com/aws/aws-sdk-js-v3/issues/2000 - # - integ_react_storage_multipart_progress + - integ_react_storage_multipart_progress - integ_react_storage_ui - integ_react_interactions - integ_angular_interactions @@ -896,12 +895,10 @@ workflows: - integ_angular_auth - integ_vue_auth - integ_rn_ios_storage - # Removing this until AWS SDK issue is resolved: https://github.com/aws/aws-sdk-js-v3/issues/2000 - # - integ_rn_ios_storage_multipart_progress + - integ_rn_ios_storage_multipart_progress - integ_rn_ios_push_notifications - integ_rn_android_storage - # Removing this until AWS SDK issue is resolved: https://github.com/aws/aws-sdk-js-v3/issues/2000 - # - integ_rn_android_storage_multipart_progress + - integ_rn_android_storage_multipart_progress - integ_datastore_auth - post_release: filters: diff --git a/.github/actions/bundle-size-action/webpack/package.json b/.github/actions/bundle-size-action/webpack/package.json index 485aa245ad8..ff593366b50 100644 --- a/.github/actions/bundle-size-action/webpack/package.json +++ b/.github/actions/bundle-size-action/webpack/package.json @@ -31,11 +31,11 @@ }, { "path": "dist/Amplify+Auth.js.min.js", - "maxSize": "70kB" + "maxSize": "75kB" }, { "path": "dist/Amplify+Auth+Storage.js.min.js", - "maxSize": "110kB" + "maxSize": "115kB" }, { "path": "dist/Amplify+Storage.js.min.js", @@ -43,11 +43,11 @@ }, { "path": "dist/withSSRContext.js.min.js", - "maxSize": "140kB" + "maxSize": "145kB" }, { "path": "dist/withSSRContext+Storage.js.min.js", - "maxSize": "175kB" + "maxSize": "180kB" } ] }, diff --git a/.github/actions/bundle-size-action/webpack4/package.json b/.github/actions/bundle-size-action/webpack4/package.json index 779d595bcae..28cac33a403 100644 --- a/.github/actions/bundle-size-action/webpack4/package.json +++ b/.github/actions/bundle-size-action/webpack4/package.json @@ -27,7 +27,7 @@ }, { "path": "dist/Amplify+Auth.js.min.js", - "maxSize": "200kB" + "maxSize": "215kB" } ] }, diff --git a/packages/analytics/package.json b/packages/analytics/package.json index 747b6afcc09..c3eab6c1aea 100644 --- a/packages/analytics/package.json +++ b/packages/analytics/package.json @@ -45,11 +45,11 @@ "dependencies": { "@aws-amplify/cache": "3.1.46", "@aws-amplify/core": "3.8.13", - "@aws-sdk/client-firehose": "1.0.0-rc.4", - "@aws-sdk/client-kinesis": "1.0.0-rc.4", - "@aws-sdk/client-personalize-events": "1.0.0-rc.4", - "@aws-sdk/client-pinpoint": "1.0.0-rc.4", - "@aws-sdk/util-utf8-browser": "1.0.0-rc.3", + "@aws-sdk/client-firehose": "3.4.1", + "@aws-sdk/client-kinesis": "3.4.1", + "@aws-sdk/client-personalize-events": "3.4.1", + "@aws-sdk/client-pinpoint": "3.4.1", + "@aws-sdk/util-utf8-browser": "3.4.1", "lodash": "^4.17.20", "uuid": "^3.2.1" }, diff --git a/packages/analytics/src/Providers/AWSPinpointProvider.ts b/packages/analytics/src/Providers/AWSPinpointProvider.ts index cd4a2682049..29b4c95ecd1 100644 --- a/packages/analytics/src/Providers/AWSPinpointProvider.ts +++ b/packages/analytics/src/Providers/AWSPinpointProvider.ts @@ -21,12 +21,12 @@ import { getAmplifyUserAgent, } from '@aws-amplify/core'; import { + EventsBatch, PinpointClient, PutEventsCommand, PutEventsCommandInput, UpdateEndpointCommand, } from '@aws-sdk/client-pinpoint'; -import { EventsBatch } from '@aws-sdk/client-pinpoint/models'; import Cache from '@aws-amplify/cache'; import { diff --git a/packages/core/package.json b/packages/core/package.json index 40857a48e26..c66a9fcbb87 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -55,10 +55,10 @@ }, "dependencies": { "@aws-crypto/sha256-js": "1.0.0-alpha.0", - "@aws-sdk/client-cognito-identity": "1.0.0-rc.4", - "@aws-sdk/credential-provider-cognito-identity": "1.0.0-rc.4", - "@aws-sdk/types": "1.0.0-rc.3", - "@aws-sdk/util-hex-encoding": "1.0.0-rc.3", + "@aws-sdk/client-cognito-identity": "3.4.1", + "@aws-sdk/credential-provider-cognito-identity": "3.4.1", + "@aws-sdk/types": "3.4.1", + "@aws-sdk/util-hex-encoding": "3.4.1", "universal-cookie": "^4.0.4", "zen-observable-ts": "0.8.19" }, diff --git a/packages/interactions/package.json b/packages/interactions/package.json index f377c1bc017..7df10d4c1e9 100644 --- a/packages/interactions/package.json +++ b/packages/interactions/package.json @@ -42,7 +42,7 @@ "homepage": "https://aws-amplify.github.io/", "dependencies": { "@aws-amplify/core": "3.8.13", - "@aws-sdk/client-lex-runtime-service": "1.0.0-rc.4" + "@aws-sdk/client-lex-runtime-service": "3.4.1" }, "jest": { "globals": { diff --git a/packages/predictions/package.json b/packages/predictions/package.json index 1992b51bc24..321d5b791f3 100644 --- a/packages/predictions/package.json +++ b/packages/predictions/package.json @@ -42,13 +42,13 @@ "dependencies": { "@aws-amplify/core": "3.8.13", "@aws-amplify/storage": "3.3.21", - "@aws-sdk/client-comprehend": "1.0.0-rc.4", - "@aws-sdk/client-polly": "1.0.0-rc.4", - "@aws-sdk/client-rekognition": "1.0.0-rc.4", - "@aws-sdk/client-textract": "1.0.0-rc.4", - "@aws-sdk/client-translate": "1.0.0-rc.4", - "@aws-sdk/eventstream-marshaller": "1.0.0-rc.3", - "@aws-sdk/util-utf8-node": "1.0.0-rc.3", + "@aws-sdk/client-comprehend": "3.4.1", + "@aws-sdk/client-polly": "3.4.1", + "@aws-sdk/client-rekognition": "3.4.1", + "@aws-sdk/client-textract": "3.4.1", + "@aws-sdk/client-translate": "3.4.1", + "@aws-sdk/eventstream-marshaller": "3.4.1", + "@aws-sdk/util-utf8-node": "3.4.1", "uuid": "^3.2.1" }, "jest": { diff --git a/packages/storage/package.json b/packages/storage/package.json index 23f843130e3..b2da39e2e99 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -42,10 +42,10 @@ "homepage": "https://aws-amplify.github.io/", "dependencies": { "@aws-amplify/core": "3.8.13", - "@aws-sdk/client-s3": "1.0.0-rc.4", - "@aws-sdk/s3-request-presigner": "1.0.0-rc.4", - "@aws-sdk/util-create-request": "1.0.0-rc.4", - "@aws-sdk/util-format-url": "1.0.0-rc.4", + "@aws-sdk/client-s3": "3.4.1", + "@aws-sdk/s3-request-presigner": "3.4.1", + "@aws-sdk/util-create-request": "3.4.1", + "@aws-sdk/util-format-url": "3.4.1", "axios": "0.21.1", "events": "^3.1.0", "sinon": "^7.5.0" diff --git a/packages/storage/src/providers/AWSS3ProviderManagedUpload.ts b/packages/storage/src/providers/AWSS3ProviderManagedUpload.ts index 59176fe59c6..018d2de5036 100644 --- a/packages/storage/src/providers/AWSS3ProviderManagedUpload.ts +++ b/packages/storage/src/providers/AWSS3ProviderManagedUpload.ts @@ -31,7 +31,6 @@ import { } from '@aws-sdk/client-s3'; import { AxiosHttpHandler, SEND_PROGRESS_EVENT } from './axios-http-handler'; import * as events from 'events'; -import { parseUrl } from '@aws-sdk/url-parser-node'; import { streamCollector } from '@aws-sdk/fetch-http-handler'; const logger = new Logger('AWSS3ProviderManagedUpload'); @@ -140,6 +139,27 @@ export class AWSS3ProviderManagedUpload { this.params ); const s3 = await this._createNewS3Client(this.opts); + + // @aws-sdk/client-s3 seems to be ignoring the `ContentType` parameter, so we + // are explicitly adding it via middleware. + // https://github.com/aws/aws-sdk-js-v3/issues/2000 + s3.middlewareStack.add( + next => (args: any) => { + if ( + this.params.ContentType && + args && + args.request && + args.request.headers + ) { + args.request.headers['Content-Type'] = this.params.ContentType; + } + return next(args); + }, + { + step: 'build', + } + ); + const response = await s3.send(createMultiPartUploadCommand); logger.debug(response.UploadId); return response.UploadId; @@ -350,7 +370,6 @@ export class AWSS3ProviderManagedUpload { ...localTestingConfig, requestHandler: new AxiosHttpHandler({}, emitter), customUserAgent: getAmplifyUserAgent(), - urlParser: parseUrl, }); client.middlewareStack.remove(SET_CONTENT_LENGTH_HEADER); return client; diff --git a/packages/storage/src/providers/axios-http-handler.ts b/packages/storage/src/providers/axios-http-handler.ts index 592e94c0a3d..feebb586261 100644 --- a/packages/storage/src/providers/axios-http-handler.ts +++ b/packages/storage/src/providers/axios-http-handler.ts @@ -16,14 +16,14 @@ import { HttpHandler, HttpRequest, HttpResponse } from '@aws-sdk/protocol-http'; import { buildQueryString } from '@aws-sdk/querystring-builder'; import axios, { AxiosRequestConfig, Method } from 'axios'; import { ConsoleLogger as Logger } from '@aws-amplify/core'; -import { BrowserHttpOptions } from '@aws-sdk/fetch-http-handler'; +import { FetchHttpHandlerOptions } from '@aws-sdk/fetch-http-handler'; const logger = new Logger('axios-http-handler'); export const SEND_PROGRESS_EVENT = 'sendProgress'; export class AxiosHttpHandler implements HttpHandler { constructor( - private readonly httpOptions: BrowserHttpOptions = {}, + private readonly httpOptions: FetchHttpHandlerOptions = {}, private readonly emitter?: any ) {}