From bb050bec8961ff52653681cf366fce043763d17b Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Thu, 28 Dec 2023 09:47:44 -0800 Subject: [PATCH] fix signing middleware not found bug --- aws/retry/middleware.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/aws/retry/middleware.go b/aws/retry/middleware.go index e956207457b..5875e1db533 100644 --- a/aws/retry/middleware.go +++ b/aws/retry/middleware.go @@ -328,9 +328,18 @@ func AddRetryMiddlewares(stack *smithymiddle.Stack, options AddRetryMiddlewaresO middleware.LogAttempts = options.LogRetryAttempts }) - if err := stack.Finalize.Insert(attempt, "Signing", smithymiddle.Before); err != nil { - return err + // index retry to before signing, if signing exists + _, ok := stack.Finalize.Get("Signing") + if !ok { + if err := stack.Finalize.Add(attempt, smithymiddle.After); err != nil { + return err + } + } else { + if err := stack.Finalize.Insert(attempt, "Signing", smithymiddle.Before); err != nil { + return err + } } + if err := stack.Finalize.Insert(&MetricsHeader{}, attempt.ID(), smithymiddle.After); err != nil { return err }