From a12f6710961c5de54d9d643add29b69a29765d07 Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Mon, 8 Apr 2024 12:22:22 +0200 Subject: [PATCH] Log more info when readWithPit catches --- .../src/actions/read_with_pit.ts | 4 ++++ .../migrations/group3/actions/actions.test.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.ts index 91652f2175ff7d..0ae10d36982654 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.ts @@ -104,6 +104,10 @@ export const readWithPit = }); }) .catch((e) => { + console.log(e); + console.log(e.message); + console.log(JSON.stringify(e.meta)); + console.log(JSON.stringify(e.body)); if ( e instanceof EsErrors.RequestAbortedError && /The content length \(\d+\) is bigger than the maximum/.test(e.message) diff --git a/src/core/server/integration_tests/saved_objects/migrations/group3/actions/actions.test.ts b/src/core/server/integration_tests/saved_objects/migrations/group3/actions/actions.test.ts index 880f56deabd19b..03e1e5c5d40066 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/group3/actions/actions.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/group3/actions/actions.test.ts @@ -1311,8 +1311,14 @@ describe('migration actions', () => { maxResponseSizeBytes: 500, // set a small size to force the error }); const rightResponse = (await readWithPitTask()) as Either.Right; - - await expect(Either.isRight(rightResponse)).toBe(true); + if (Either.isRight(rightResponse)) { + await expect(Either.isRight(rightResponse)).toBe(true); + } else { + console.log( + 'got a left: ', + (rightResponse as Either.Left).left.type + ); + } readWithPitTask = readWithPit({ client,