Skip to content

Commit

Permalink
Fix @aws-amplify/analytics. - Pinpoint header correction (aws-amplify…
Browse files Browse the repository at this point in the history
…#6392)

* pinpoint header correction

* Add TODO for removing the code later
  • Loading branch information
ashika01 authored Jul 23, 2020
1 parent 5682f22 commit 84c620a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/analytics/src/Providers/AWSPinpointProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,20 @@ export class AWSPinpointProvider implements AnalyticsProvider {
credentials,
customUserAgent: getAmplifyUserAgent(),
});

// TODO: remove this middleware once a long term fix is implemented by aws-sdk-js team.
this.pinpointClient.middlewareStack.addRelativeTo(
next => args => {
delete args.request.headers['amz-sdk-invocation-id'];
delete args.request.headers['amz-sdk-request'];
return next(args);
},
{
step: 'finalizeRequest',
relation: 'after',
toMiddleware: 'retryMiddleware',
}
);

if (this._bufferExists() && identityId === credentials.identityId) {
// if the identity has remained the same, pass the updated client to the buffer
Expand Down

0 comments on commit 84c620a

Please sign in to comment.