From 18955a175c7ede8122ccbb8427df4500940301e5 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 14 Dec 2020 18:57:22 +0000 Subject: [PATCH 1/7] chore(middleware-logger): log clientName and commandName --- .../src/loggerMiddleware.spec.ts | 112 ++++++++++-------- .../middleware-logger/src/loggerMiddleware.ts | 4 +- 2 files changed, 63 insertions(+), 53 deletions(-) diff --git a/packages/middleware-logger/src/loggerMiddleware.spec.ts b/packages/middleware-logger/src/loggerMiddleware.spec.ts index 749dc97f952a..fe3d1f0d35c8 100644 --- a/packages/middleware-logger/src/loggerMiddleware.spec.ts +++ b/packages/middleware-logger/src/loggerMiddleware.spec.ts @@ -64,61 +64,69 @@ describe("loggerMiddleware", () => { expect(response).toStrictEqual(mockResponse); }); - it("logs metadata if context.logger has info function", async () => { - mockNext.mockResolvedValueOnce(mockResponse); - const logger = ({ info: jest.fn() } as unknown) as Logger; - - const context = { - logger, - }; - - const response = await loggerMiddleware()(mockNext, context)(mockArgs); - expect(mockNext).toHaveBeenCalledTimes(1); - expect(response).toStrictEqual(mockResponse); - - expect(logger.info).toHaveBeenCalledTimes(1); - - expect(logger.info).toHaveBeenCalledWith({ - metadata: { - statusCode: mockResponse.response.statusCode, - requestId: mockResponse.response.headers["x-amzn-requestid"], - extendedRequestId: mockResponse.response.headers["x-amz-id-2"], - cfId: mockResponse.response.headers["x-amz-cf-id"], - }, + describe("logs if context.logger has info function", () => { + it("success case with clientName, commandName, metadata", async () => { + mockNext.mockResolvedValueOnce(mockResponse); + const logger = ({ info: jest.fn() } as unknown) as Logger; + const clientName = "mockClientName"; + const commandName = "mockCommandName"; + + const context = { + logger, + clientName, + commandName, + }; + + const response = await loggerMiddleware()(mockNext, context)(mockArgs); + expect(mockNext).toHaveBeenCalledTimes(1); + expect(response).toStrictEqual(mockResponse); + + expect(logger.info).toHaveBeenCalledTimes(1); + + expect(logger.info).toHaveBeenCalledWith({ + clientName, + commandName, + metadata: { + statusCode: mockResponse.response.statusCode, + requestId: mockResponse.response.headers["x-amzn-requestid"], + extendedRequestId: mockResponse.response.headers["x-amz-id-2"], + cfId: mockResponse.response.headers["x-amz-cf-id"], + }, + }); }); - }); - it("logs header x-amzn-request-id as requestId if x-amzn-requestid is not present", async () => { - const requestIdBackup = "requestIdBackup"; - const customResponse = { - ...mockResponse, - response: { - ...mockResponse.response, - headers: { - "x-amzn-request-id": requestIdBackup, + it("header x-amzn-request-id as requestId if x-amzn-requestid is not present", async () => { + const requestIdBackup = "requestIdBackup"; + const customResponse = { + ...mockResponse, + response: { + ...mockResponse.response, + headers: { + "x-amzn-request-id": requestIdBackup, + }, }, - }, - }; - mockNext.mockResolvedValueOnce(customResponse); - const logger = ({ info: jest.fn() } as unknown) as Logger; - - const context = { - logger, - }; - - const response = await loggerMiddleware()(mockNext, context)(mockArgs); - expect(mockNext).toHaveBeenCalledTimes(1); - expect(response).toStrictEqual(customResponse); - - expect(logger.info).toHaveBeenCalledTimes(1); - - expect(logger.info).toHaveBeenCalledWith({ - metadata: { - statusCode: customResponse.response.statusCode, - requestId: requestIdBackup, - extendedRequestId: undefined, - cfId: undefined, - }, + }; + mockNext.mockResolvedValueOnce(customResponse); + const logger = ({ info: jest.fn() } as unknown) as Logger; + + const context = { + logger, + }; + + const response = await loggerMiddleware()(mockNext, context)(mockArgs); + expect(mockNext).toHaveBeenCalledTimes(1); + expect(response).toStrictEqual(customResponse); + + expect(logger.info).toHaveBeenCalledTimes(1); + + expect(logger.info).toHaveBeenCalledWith({ + metadata: { + statusCode: customResponse.response.statusCode, + requestId: requestIdBackup, + extendedRequestId: undefined, + cfId: undefined, + }, + }); }); }); }); diff --git a/packages/middleware-logger/src/loggerMiddleware.ts b/packages/middleware-logger/src/loggerMiddleware.ts index 42c3b36f74e6..fb04e276fd84 100644 --- a/packages/middleware-logger/src/loggerMiddleware.ts +++ b/packages/middleware-logger/src/loggerMiddleware.ts @@ -16,7 +16,7 @@ export const loggerMiddleware = () => => async ( args: InitializeHandlerArguments ): Promise> => { - const { logger } = context; + const { clientName, commandName, logger } = context; const response = await next(args); @@ -28,6 +28,8 @@ export const loggerMiddleware = () => Date: Mon, 14 Dec 2020 19:17:23 +0000 Subject: [PATCH 2/7] chore(middleware-logger): log input --- .../middleware-logger/src/loggerMiddleware.spec.ts | 14 ++++++++++++-- packages/middleware-logger/src/loggerMiddleware.ts | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/middleware-logger/src/loggerMiddleware.spec.ts b/packages/middleware-logger/src/loggerMiddleware.spec.ts index fe3d1f0d35c8..c0c82380698d 100644 --- a/packages/middleware-logger/src/loggerMiddleware.spec.ts +++ b/packages/middleware-logger/src/loggerMiddleware.spec.ts @@ -65,27 +65,34 @@ describe("loggerMiddleware", () => { }); describe("logs if context.logger has info function", () => { - it("success case with clientName, commandName, metadata", async () => { + it("success case with clientName, commandName, input, metadata", async () => { mockNext.mockResolvedValueOnce(mockResponse); + const logger = ({ info: jest.fn() } as unknown) as Logger; const clientName = "mockClientName"; const commandName = "mockCommandName"; + const mockInputLog = { inputKey: "inputKey", inputSensitiveKey: "SENSITIVE_VALUE" }; + const inputFilterSensitiveLog = jest.fn().mockReturnValueOnce(mockInputLog); + const context = { logger, clientName, commandName, + inputFilterSensitiveLog, }; const response = await loggerMiddleware()(mockNext, context)(mockArgs); expect(mockNext).toHaveBeenCalledTimes(1); expect(response).toStrictEqual(mockResponse); + expect(inputFilterSensitiveLog).toHaveBeenCalledTimes(1); + expect(inputFilterSensitiveLog).toHaveBeenCalledWith(mockArgs.input); expect(logger.info).toHaveBeenCalledTimes(1); - expect(logger.info).toHaveBeenCalledWith({ clientName, commandName, + input: mockInputLog, metadata: { statusCode: mockResponse.response.statusCode, requestId: mockResponse.response.headers["x-amzn-requestid"], @@ -108,9 +115,11 @@ describe("loggerMiddleware", () => { }; mockNext.mockResolvedValueOnce(customResponse); const logger = ({ info: jest.fn() } as unknown) as Logger; + const inputFilterSensitiveLog = jest.fn().mockImplementationOnce((input) => input); const context = { logger, + inputFilterSensitiveLog, }; const response = await loggerMiddleware()(mockNext, context)(mockArgs); @@ -120,6 +129,7 @@ describe("loggerMiddleware", () => { expect(logger.info).toHaveBeenCalledTimes(1); expect(logger.info).toHaveBeenCalledWith({ + input: mockArgs.input, metadata: { statusCode: customResponse.response.statusCode, requestId: requestIdBackup, diff --git a/packages/middleware-logger/src/loggerMiddleware.ts b/packages/middleware-logger/src/loggerMiddleware.ts index fb04e276fd84..21c7c2122c30 100644 --- a/packages/middleware-logger/src/loggerMiddleware.ts +++ b/packages/middleware-logger/src/loggerMiddleware.ts @@ -16,7 +16,7 @@ export const loggerMiddleware = () => => async ( args: InitializeHandlerArguments ): Promise> => { - const { clientName, commandName, logger } = context; + const { clientName, commandName, inputFilterSensitiveLog, logger } = context; const response = await next(args); @@ -30,6 +30,7 @@ export const loggerMiddleware = () => Date: Mon, 14 Dec 2020 19:28:11 +0000 Subject: [PATCH 3/7] chore(middleware-serde): remove logging of input from serMiddleware --- .../src/serializerMiddleware.spec.ts | 48 +++++-------------- .../src/serializerMiddleware.ts | 9 ---- 2 files changed, 12 insertions(+), 45 deletions(-) diff --git a/packages/middleware-serde/src/serializerMiddleware.spec.ts b/packages/middleware-serde/src/serializerMiddleware.spec.ts index dac41875ccf3..079c0a15b8be 100644 --- a/packages/middleware-serde/src/serializerMiddleware.spec.ts +++ b/packages/middleware-serde/src/serializerMiddleware.spec.ts @@ -1,4 +1,4 @@ -import { Logger } from "@aws-sdk/types"; +import { EndpointBearer } from "@aws-sdk/types"; import { serializerMiddleware } from "./serializerMiddleware"; @@ -15,12 +15,6 @@ describe("serializerMiddleware", () => { }), }; - const mockArgs = { - input: { - inputKey: "inputValue", - }, - }; - const mockRequest = { method: "GET", headers: {}, @@ -44,43 +38,25 @@ describe("serializerMiddleware", () => { output: mockOutput, }; + const mockArgs = { + input: { + inputKey: "inputValue", + }, + }; + beforeEach(() => { mockNext.mockResolvedValueOnce(mockReturn); mockSerializer.mockResolvedValueOnce(mockRequest); }); - afterEach(() => { + it("calls serializer and populates request object", async () => { + await expect(serializerMiddleware(mockOptions, mockSerializer)(mockNext, {})(mockArgs)).resolves.toStrictEqual( + mockReturn + ); + expect(mockSerializer).toHaveBeenCalledTimes(1); expect(mockSerializer).toHaveBeenCalledWith(mockArgs.input, mockOptions); expect(mockNext).toHaveBeenCalledTimes(1); expect(mockNext).toHaveBeenCalledWith({ ...mockArgs, request: mockRequest }); - jest.clearAllMocks(); - }); - - it("returns without logging if context.logger is not defined", async () => { - const response = await serializerMiddleware(mockOptions, mockSerializer)(mockNext, {})(mockArgs); - expect(response).toStrictEqual(mockReturn); - }); - - it("returns without logging if context.logger doesn't have debug/info function", async () => { - const logger = {} as Logger; - const response = await serializerMiddleware(mockOptions, mockSerializer)(mockNext, { logger })(mockArgs); - expect(response).toStrictEqual(mockReturn); - }); - - it("logs input if context.logger has info function", async () => { - const logger = ({ info: jest.fn() } as unknown) as Logger; - - const inputFilterSensitiveLog = jest.fn().mockImplementationOnce((input) => input); - const response = await serializerMiddleware(mockOptions, mockSerializer)(mockNext, { - logger, - inputFilterSensitiveLog, - })(mockArgs); - - expect(response).toStrictEqual(mockReturn); - expect(inputFilterSensitiveLog).toHaveBeenCalledTimes(1); - expect(inputFilterSensitiveLog).toHaveBeenCalledWith(mockArgs.input); - expect(logger.info).toHaveBeenCalledTimes(1); - expect(logger.info).toHaveBeenCalledWith({ input: mockArgs.input }); }); }); diff --git a/packages/middleware-serde/src/serializerMiddleware.ts b/packages/middleware-serde/src/serializerMiddleware.ts index 58d0d0e90cb2..49b7601fc7bc 100644 --- a/packages/middleware-serde/src/serializerMiddleware.ts +++ b/packages/middleware-serde/src/serializerMiddleware.ts @@ -17,16 +17,7 @@ export const serializerMiddleware = => async ( args: SerializeHandlerArguments ): Promise> => { - const { logger, inputFilterSensitiveLog } = context; - - if (typeof logger?.info === "function") { - logger.info({ - input: inputFilterSensitiveLog(args.input), - }); - } - const request = await serializer(args.input, options); - return next({ ...args, request, From 457212097907ebd8c01209c55426fe8504ddf2b9 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 14 Dec 2020 19:39:45 +0000 Subject: [PATCH 4/7] chore(middleware-logger): log output --- .../src/loggerMiddleware.spec.ts | 26 ++++++++++++++++--- .../middleware-logger/src/loggerMiddleware.ts | 7 ++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/packages/middleware-logger/src/loggerMiddleware.spec.ts b/packages/middleware-logger/src/loggerMiddleware.spec.ts index c0c82380698d..847f280a063f 100644 --- a/packages/middleware-logger/src/loggerMiddleware.spec.ts +++ b/packages/middleware-logger/src/loggerMiddleware.spec.ts @@ -31,6 +31,14 @@ describe("loggerMiddleware", () => { }, }; + const mockOutput = { + $metadata: { + statusCode: 200, + requestId: "requestId", + }, + outputKey: "outputValue", + }; + const mockResponse = { response: { statusCode: 200, @@ -40,9 +48,7 @@ describe("loggerMiddleware", () => { "x-amz-cf-id": "cfId", }, }, - output: { - outputKey: "outputValue", - }, + output: mockOutput, }; afterEach(() => { @@ -74,12 +80,15 @@ describe("loggerMiddleware", () => { const mockInputLog = { inputKey: "inputKey", inputSensitiveKey: "SENSITIVE_VALUE" }; const inputFilterSensitiveLog = jest.fn().mockReturnValueOnce(mockInputLog); + const mockOutputLog = { outputKey: "outputKey", outputSensitiveKey: "SENSITIVE_VALUE" }; + const outputFilterSensitiveLog = jest.fn().mockReturnValueOnce(mockOutputLog); const context = { logger, clientName, commandName, inputFilterSensitiveLog, + outputFilterSensitiveLog, }; const response = await loggerMiddleware()(mockNext, context)(mockArgs); @@ -88,11 +97,17 @@ describe("loggerMiddleware", () => { expect(inputFilterSensitiveLog).toHaveBeenCalledTimes(1); expect(inputFilterSensitiveLog).toHaveBeenCalledWith(mockArgs.input); + + const { $metadata, ...outputWithoutMetadata } = mockOutput; + expect(outputFilterSensitiveLog).toHaveBeenCalledTimes(1); + expect(outputFilterSensitiveLog).toHaveBeenCalledWith(outputWithoutMetadata); + expect(logger.info).toHaveBeenCalledTimes(1); expect(logger.info).toHaveBeenCalledWith({ clientName, commandName, input: mockInputLog, + output: mockOutputLog, metadata: { statusCode: mockResponse.response.statusCode, requestId: mockResponse.response.headers["x-amzn-requestid"], @@ -116,20 +131,23 @@ describe("loggerMiddleware", () => { mockNext.mockResolvedValueOnce(customResponse); const logger = ({ info: jest.fn() } as unknown) as Logger; const inputFilterSensitiveLog = jest.fn().mockImplementationOnce((input) => input); + const outputFilterSensitiveLog = jest.fn().mockImplementationOnce((output) => output); const context = { logger, inputFilterSensitiveLog, + outputFilterSensitiveLog, }; const response = await loggerMiddleware()(mockNext, context)(mockArgs); expect(mockNext).toHaveBeenCalledTimes(1); expect(response).toStrictEqual(customResponse); + const { $metadata, ...outputWithoutMetadata } = mockOutput; expect(logger.info).toHaveBeenCalledTimes(1); - expect(logger.info).toHaveBeenCalledWith({ input: mockArgs.input, + output: outputWithoutMetadata, metadata: { statusCode: customResponse.response.statusCode, requestId: requestIdBackup, diff --git a/packages/middleware-logger/src/loggerMiddleware.ts b/packages/middleware-logger/src/loggerMiddleware.ts index 21c7c2122c30..004013b1f7a3 100644 --- a/packages/middleware-logger/src/loggerMiddleware.ts +++ b/packages/middleware-logger/src/loggerMiddleware.ts @@ -16,7 +16,7 @@ export const loggerMiddleware = () => => async ( args: InitializeHandlerArguments ): Promise> => { - const { clientName, commandName, inputFilterSensitiveLog, logger } = context; + const { clientName, commandName, inputFilterSensitiveLog, logger, outputFilterSensitiveLog } = context; const response = await next(args); @@ -24,13 +24,14 @@ export const loggerMiddleware = () => Date: Mon, 14 Dec 2020 19:47:58 +0000 Subject: [PATCH 5/7] chore(middleware-serde): remove logging of input from deserMiddleware --- .../src/deserializerMiddleware.spec.ts | 39 ++++--------------- .../src/deserializerMiddleware.ts | 13 ------- 2 files changed, 8 insertions(+), 44 deletions(-) diff --git a/packages/middleware-serde/src/deserializerMiddleware.spec.ts b/packages/middleware-serde/src/deserializerMiddleware.spec.ts index 3f841dc9c796..88043c3a0d6b 100644 --- a/packages/middleware-serde/src/deserializerMiddleware.spec.ts +++ b/packages/middleware-serde/src/deserializerMiddleware.spec.ts @@ -1,5 +1,3 @@ -import { Logger } from "@aws-sdk/types"; - import { deserializerMiddleware } from "./deserializerMiddleware"; describe("deserializerMiddleware", () => { @@ -51,38 +49,17 @@ describe("deserializerMiddleware", () => { }); afterEach(() => { - expect(mockNext).toHaveBeenCalledTimes(1); - expect(mockNext).toHaveBeenCalledWith(mockArgs); - expect(mockDeserializer).toHaveBeenCalledTimes(1); - expect(mockDeserializer).toHaveBeenCalledWith(mockNextResponse.response, mockOptions); jest.clearAllMocks(); }); - it("returns without logging if context.logger is not defined", async () => { - const response = await deserializerMiddleware(mockOptions, mockDeserializer)(mockNext, {})(mockArgs); - expect(response).toStrictEqual(mockResponse); - }); - - it("returns without logging if context.logger doesn't have debug/info function", async () => { - const logger = {} as Logger; - const response = await deserializerMiddleware(mockOptions, mockDeserializer)(mockNext, { logger })(mockArgs); - expect(response).toStrictEqual(mockResponse); - }); - - it("logs output if context.logger has info function", async () => { - const logger = ({ info: jest.fn() } as unknown) as Logger; + it("calls deserializer and populates response object", async () => { + await expect(deserializerMiddleware(mockOptions, mockDeserializer)(mockNext, {})(mockArgs)).resolves.toStrictEqual( + mockResponse + ); - const outputFilterSensitiveLog = jest.fn().mockImplementationOnce((output) => output); - const response = await deserializerMiddleware(mockOptions, mockDeserializer)(mockNext, { - logger, - outputFilterSensitiveLog: outputFilterSensitiveLog, - })(mockArgs); - - const { $metadata, ...outputWithoutMetadata } = mockOutput; - expect(response).toStrictEqual(mockResponse); - expect(outputFilterSensitiveLog).toHaveBeenCalledTimes(1); - expect(outputFilterSensitiveLog).toHaveBeenCalledWith(outputWithoutMetadata); - expect(logger.info).toHaveBeenCalledTimes(1); - expect(logger.info).toHaveBeenCalledWith({ output: outputWithoutMetadata }); + expect(mockNext).toHaveBeenCalledTimes(1); + expect(mockNext).toHaveBeenCalledWith(mockArgs); + expect(mockDeserializer).toHaveBeenCalledTimes(1); + expect(mockDeserializer).toHaveBeenCalledWith(mockNextResponse.response, mockOptions); }); }); diff --git a/packages/middleware-serde/src/deserializerMiddleware.ts b/packages/middleware-serde/src/deserializerMiddleware.ts index c8af8b60c8e5..56377bf21a88 100644 --- a/packages/middleware-serde/src/deserializerMiddleware.ts +++ b/packages/middleware-serde/src/deserializerMiddleware.ts @@ -16,21 +16,8 @@ export const deserializerMiddleware = => async ( args: DeserializeHandlerArguments ): Promise> => { - const { logger, outputFilterSensitiveLog } = context; - const { response } = await next(args); - const parsed = await deserializer(response, options); - - // Log parsed after $metadata is removed in https://github.com/aws/aws-sdk-js-v3/issues/1490 - const { $metadata, ...outputWithoutMetadata } = parsed; - - if (typeof logger?.info === "function") { - logger.info({ - output: outputFilterSensitiveLog(outputWithoutMetadata), - }); - } - return { response, output: parsed as Output, From 7e372d626ed49c1eec51204a8fd1b44470e6f43e Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 14 Dec 2020 19:56:55 +0000 Subject: [PATCH 6/7] chore(middleware-logger): log retry numbers --- .../middleware-logger/src/loggerMiddleware.spec.ts | 10 ++++++++++ packages/middleware-logger/src/loggerMiddleware.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/packages/middleware-logger/src/loggerMiddleware.spec.ts b/packages/middleware-logger/src/loggerMiddleware.spec.ts index 847f280a063f..a105e2c9b940 100644 --- a/packages/middleware-logger/src/loggerMiddleware.spec.ts +++ b/packages/middleware-logger/src/loggerMiddleware.spec.ts @@ -35,6 +35,8 @@ describe("loggerMiddleware", () => { $metadata: { statusCode: 200, requestId: "requestId", + attempts: 2, + totalRetryDelay: 350, }, outputKey: "outputValue", }; @@ -108,6 +110,10 @@ describe("loggerMiddleware", () => { commandName, input: mockInputLog, output: mockOutputLog, + retry: { + attempts: $metadata.attempts, + totalDelay: $metadata.totalRetryDelay, + }, metadata: { statusCode: mockResponse.response.statusCode, requestId: mockResponse.response.headers["x-amzn-requestid"], @@ -148,6 +154,10 @@ describe("loggerMiddleware", () => { expect(logger.info).toHaveBeenCalledWith({ input: mockArgs.input, output: outputWithoutMetadata, + retry: { + attempts: $metadata.attempts, + totalDelay: $metadata.totalRetryDelay, + }, metadata: { statusCode: customResponse.response.statusCode, requestId: requestIdBackup, diff --git a/packages/middleware-logger/src/loggerMiddleware.ts b/packages/middleware-logger/src/loggerMiddleware.ts index 004013b1f7a3..a71bf96d68dc 100644 --- a/packages/middleware-logger/src/loggerMiddleware.ts +++ b/packages/middleware-logger/src/loggerMiddleware.ts @@ -32,6 +32,10 @@ export const loggerMiddleware = () => Date: Mon, 14 Dec 2020 20:00:45 +0000 Subject: [PATCH 7/7] fix(middleware-logger): move retry inside metadata --- .../src/loggerMiddleware.spec.ts | 16 ++++++++-------- .../middleware-logger/src/loggerMiddleware.ts | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/middleware-logger/src/loggerMiddleware.spec.ts b/packages/middleware-logger/src/loggerMiddleware.spec.ts index a105e2c9b940..9a5d71484d67 100644 --- a/packages/middleware-logger/src/loggerMiddleware.spec.ts +++ b/packages/middleware-logger/src/loggerMiddleware.spec.ts @@ -110,15 +110,15 @@ describe("loggerMiddleware", () => { commandName, input: mockInputLog, output: mockOutputLog, - retry: { - attempts: $metadata.attempts, - totalDelay: $metadata.totalRetryDelay, - }, metadata: { statusCode: mockResponse.response.statusCode, requestId: mockResponse.response.headers["x-amzn-requestid"], extendedRequestId: mockResponse.response.headers["x-amz-id-2"], cfId: mockResponse.response.headers["x-amz-cf-id"], + retry: { + attempts: $metadata.attempts, + totalDelay: $metadata.totalRetryDelay, + }, }, }); }); @@ -154,15 +154,15 @@ describe("loggerMiddleware", () => { expect(logger.info).toHaveBeenCalledWith({ input: mockArgs.input, output: outputWithoutMetadata, - retry: { - attempts: $metadata.attempts, - totalDelay: $metadata.totalRetryDelay, - }, metadata: { statusCode: customResponse.response.statusCode, requestId: requestIdBackup, extendedRequestId: undefined, cfId: undefined, + retry: { + attempts: $metadata.attempts, + totalDelay: $metadata.totalRetryDelay, + }, }, }); }); diff --git a/packages/middleware-logger/src/loggerMiddleware.ts b/packages/middleware-logger/src/loggerMiddleware.ts index a71bf96d68dc..c4c0117ef143 100644 --- a/packages/middleware-logger/src/loggerMiddleware.ts +++ b/packages/middleware-logger/src/loggerMiddleware.ts @@ -32,15 +32,15 @@ export const loggerMiddleware = () =>