Skip to content
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

chore: update to aws-sdk 3.4.1 #7726

Merged
merged 12 commits into from
Feb 10, 2021
Merged

Conversation

amhinson
Copy link
Contributor

Issue #, if available:

Description of changes:

  • Upgrade to latest version of aws-sdk modular packages

Reference: https://github.com/aws/aws-sdk-js-v3/releases

Successful CircleCI build with integration tests: https://app.circleci.com/pipelines/github/aws-amplify/amplify-js/7181/workflows/171bfbee-0e77-43ff-9478-3d20ae5176bd


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -21,12 +21,12 @@ import {
getAmplifyUserAgent,
} from '@aws-amplify/core';
import {
EventsBatch,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to import from @aws-sdk/client-pinpoint/models since it is exported from the root: https://github.com/aws/aws-sdk-js-v3/blob/master/clients/client-pinpoint/index.ts#L115

@@ -350,7 +370,6 @@ export class AWSS3ProviderManagedUpload {
...localTestingConfig,
requestHandler: new AxiosHttpHandler({}, emitter),
customUserAgent: getAmplifyUserAgent(),
urlParser: parseUrl,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per conversation with SDK team, there is no need to explicitly pass urlParser because S3Client already knows what parser needs to be used based on the environment. Based on initial testing, this change doesn't seem to have any impact on functionality.

This was removed because @aws-sdk/url-parser-node has a breaking change for React Native.

@@ -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';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was renamed in rc.8: aws/aws-sdk-js-v3#1697

Comment on lines +143 to +161
// @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',
}
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is pretty self explanatory, but there appears to be an issue with the SDK where it is removing ContentType when creating CreateMultipartUploadCommand, which causes multi-part uploads to fail. For now, we can get around this by using middleware, and we can revisit this in future SDK upgrades.

We now have multiple tests in CircleCI for React & React Native (iOS & Android) to validate multi-part uploads.

@amhinson amhinson requested a review from wlee221 February 10, 2021 20:46
@codecov
Copy link

codecov bot commented Feb 10, 2021

Codecov Report

Merging #7726 (abe342e) into main (c92231e) will decrease coverage by 0.02%.
The diff coverage is 37.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7726      +/-   ##
==========================================
- Coverage   74.10%   74.07%   -0.03%     
==========================================
  Files         214      214              
  Lines       13405    13410       +5     
  Branches     2626     2628       +2     
==========================================
  Hits         9934     9934              
- Misses       3272     3277       +5     
  Partials      199      199              
Impacted Files Coverage Δ
...ges/analytics/src/Providers/AWSPinpointProvider.ts 77.36% <ø> (ø)
...torage/src/providers/AWSS3ProviderManagedUpload.ts 89.67% <16.66%> (-2.99%) ⬇️
packages/core/src/Platform/version.ts 100.00% <100.00%> (ø)
...ckages/storage/src/providers/axios-http-handler.ts 75.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e5e2e2...abe342e. Read the comment docs.

Copy link
Contributor

@manueliglesias manueliglesias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Thanks @amhinson

@amhinson amhinson merged commit e39a71d into aws-amplify:main Feb 10, 2021
@elorzafe
Copy link
Contributor

Thanks @amhinson!! 🌮 🎉

@wlee221
Copy link
Contributor

wlee221 commented Feb 11, 2021

Ty @amhinson 👍 👍

@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants