You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(auth): handle SyntaxError edge case in refresh credentials (#5526)
## Problem:
There is a small edge case where there are SOMETIMES missing fields in a
SyntaxError, in this case the $response or its reason field do not
exist. Due to this those cases are causing a connection to become
invalid when refresh credentials fails.
## Solution:
Handle the case where those fields are missing and gracefully handle
them by still marking it as an AwsClientResponseError. Since we cannot
extract the underlying error message, we set a custom errors message for
those cases.
Now this will not cause a failed refresh credential to invalidate.
---
<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->
License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Signed-off-by: Nikolas Komonen <[email protected]>
// The following error messages are not arbitrary, changing them can break functionality
488
+
constsyntaxError: Error=newSyntaxError(
489
+
'Unexpected token \'<\', "<html><bod"... is not valid JSON Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.'
490
+
)
488
491
// Under the hood of a SyntaxError may be a hidden field with the real reason for the failure
489
492
;(syntaxErrorasany)['$response']={reason: 'SDK Client unexpected error response: data response code: 500'}
490
493
returnsyntaxError
@@ -537,18 +540,58 @@ describe('util', function () {
0 commit comments