Skip to content

Commit 0a91379

Browse files
committed
fix: set skew offset in catch block upon failure
1 parent af23369 commit 0a91379

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/middleware-signing/src/middleware.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ export function awsAuthMiddleware<Input extends object, Output extends object>(
3030
signingRegion: context["signing_region"],
3131
signingService: context["signing_service"],
3232
}),
33+
}).catch((error) => {
34+
if (error.Code === "RequestTimeTooSkewed") {
35+
const serverTime = Date.parse(error.ServerTime);
36+
const newOffset = serverTime - Date.now();
37+
options.systemClockOffset = newOffset;
38+
}
39+
throw error;
3340
});
3441

3542
const { headers } = output.response as any;

0 commit comments

Comments
 (0)