From 17536f0ab4b8433381e2bd38d0fa04cf800b5a5f Mon Sep 17 00:00:00 2001 From: garma00 Date: Thu, 17 Nov 2022 14:44:30 +0100 Subject: [PATCH 1/8] Update @pagopa/io-functions-commons to 26.2.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 00d211eb..2fe5c760 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "dependencies": { "@azure/cosmos": "^3.17.1", "@pagopa/express-azure-functions": "^2.0.0", - "@pagopa/io-functions-commons": "^26.1.1", + "@pagopa/io-functions-commons": "^26.2.0", "@pagopa/ts-commons": "^10.10.0", "applicationinsights": "^1.7.4", "azure-storage": "^2.10.4", diff --git a/yarn.lock b/yarn.lock index cb882f0b..3b707dbf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -751,10 +751,10 @@ resolved "https://registry.yarnpkg.com/@pagopa/express-azure-functions/-/express-azure-functions-2.0.0.tgz#eb52a0b997d931c1509372e2a9bea22a8ca85c17" integrity sha512-IFZqtk0e2sfkMZIxYqPORzxcKRkbIrVJesR6eMLNwzh1rA4bl2uh9ZHk1m55LNq4ZmaxREDu+1JcGlIaZQgKNQ== -"@pagopa/io-functions-commons@^26.1.1": - version "26.1.1" - resolved "https://registry.yarnpkg.com/@pagopa/io-functions-commons/-/io-functions-commons-26.1.1.tgz#3c29868dcb146eeb8f5ba0bee6d8f6b83dc968e5" - integrity sha512-QWR9NP+fF4t0sSsQwUXqD4H4areW6Y65tuJKvC4J7AjmmgpF4p67oP/YorbOa2AR9dP9ct4PV4viXTaQCwBKfw== +"@pagopa/io-functions-commons@^26.2.0": + version "26.2.0" + resolved "https://registry.yarnpkg.com/@pagopa/io-functions-commons/-/io-functions-commons-26.2.0.tgz#f828075f78ee57b9ca73956cb35a77652835df48" + integrity sha512-6GMivFVaY343bA8Otx+JsCkUfK18xvF9YA4UxFNf3uxkHwvtGprZCKdIRBa4Y+pKdFZMZrcXIXHv/GcuckBQSw== dependencies: "@azure/cosmos" "^3.17.1" "@pagopa/ts-commons" "^10.9.0" From 67acb5ab5ed8b0bb512eb226a66e3e28ec9d56d2 Mon Sep 17 00:00:00 2001 From: garma00 Date: Thu, 17 Nov 2022 16:22:28 +0100 Subject: [PATCH 2/8] Use messageStatusUpdater to set ttl --- .../__tests__/handler.test.ts | 26 ++++---- ProcessMessage/__tests__/handler.test.ts | 20 ++++-- ProcessMessage/handler.ts | 61 ++++++++++++------- 3 files changed, 69 insertions(+), 38 deletions(-) diff --git a/OnFailedProcessMessage/__tests__/handler.test.ts b/OnFailedProcessMessage/__tests__/handler.test.ts index 58d673c2..582023cf 100644 --- a/OnFailedProcessMessage/__tests__/handler.test.ts +++ b/OnFailedProcessMessage/__tests__/handler.test.ts @@ -45,19 +45,19 @@ const aCreatedMessageEvent: CreatedMessageEvent = { beforeEach(() => { jest.clearAllMocks(); // Mock getMessageStatusUpdater - getMessageStatusUpdaterMock.mockImplementation( - ( - _messageStatusModel: MS.MessageStatusModel, - messageId: NonEmptyString, - fiscalCode: FiscalCode - ) => (status: Parameters[0]) => - TE.right({ - ...aRetrievedMessageStatus, - id: messageId, - messageId, - ...status, - fiscalCode - }) + getMessageStatusUpdaterMock.mockImplementation(( + _messageStatusModel: MS.MessageStatusModel, + messageId: NonEmptyString, + fiscalCode: FiscalCode + // status type does not match anymore for some reason + ) => (status: any) => + TE.right({ + ...aRetrievedMessageStatus, + id: messageId, + messageId, + ...status, + fiscalCode + }) ); getQueryIteratorMock.mockImplementation(() => { const asyncIterable = { diff --git a/ProcessMessage/__tests__/handler.test.ts b/ProcessMessage/__tests__/handler.test.ts index 95284be3..c1cd9f10 100644 --- a/ProcessMessage/__tests__/handler.test.ts +++ b/ProcessMessage/__tests__/handler.test.ts @@ -64,6 +64,7 @@ import { ServiceId } from "@pagopa/io-functions-commons/dist/generated/definitio import { RejectedMessageStatusValueEnum } from "@pagopa/io-functions-commons/dist/generated/definitions/RejectedMessageStatusValue"; import { RejectionReasonEnum } from "@pagopa/io-functions-commons/dist/generated/definitions/RejectionReason"; import { CosmosErrors } from "@pagopa/io-functions-commons/dist/src/utils/cosmosdb_model"; +import { Ttl } from "@pagopa/io-functions-commons/dist/src/utils/cosmosdb_model_ttl"; const TTL_FOR_USER_NOT_FOUND = 94670856 as NonNegativeInteger; const isUserEligibleForNewFeature = (_: FiscalCode) => true; @@ -277,7 +278,8 @@ beforeEach(() => { messageId: NonEmptyString, fiscalCode: FiscalCode ) => - jest.fn((status: Parameters[0]) => + // status type does not match anymore for some reason + jest.fn((status: any) => TE.right({ _etag: "a", _rid: "a", @@ -824,11 +826,17 @@ describe("getprocessMessageHandler", () => { const messageStatusUpdaterMock = getMessageStatusUpdaterMock.mock.results[0] .value as jest.Mock; expect(messageStatusUpdaterMock).toHaveBeenCalledTimes(1); + expect(messageStatusUpdaterMock).toHaveBeenCalledWith({ + rejection_reason: "USER_NOT_FOUND", + status: "REJECTED", + ttl: 94670856 + }); const messageStatusUpdaterParam = messageStatusUpdaterMock.mock.calls[0][0]; expect(messageStatusUpdaterParam).toEqual({ status: RejectedMessageStatusValueEnum.REJECTED, - rejection_reason: RejectionReasonEnum.USER_NOT_FOUND + rejection_reason: RejectionReasonEnum.USER_NOT_FOUND, + ttl: 94670856 }); // check if models are being used only when expected @@ -875,7 +883,9 @@ describe("getprocessMessageHandler", () => { await expect( processMessageHandler(context, JSON.stringify(aCreatedMessageEvent)) - ).rejects.toThrow("Error while setting ttl"); + ).rejects.toThrow( + "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" + ); }); it("it should throw an error if the set of ttl on message status fails", async () => { @@ -908,6 +918,8 @@ describe("getprocessMessageHandler", () => { await expect( processMessageHandler(context, JSON.stringify(aCreatedMessageEvent)) - ).rejects.toThrow("Error while setting ttl"); + ).rejects.toThrow( + "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" + ); }); }); diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index 2bbb0111..afcf477f 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -41,6 +41,7 @@ import * as T from "fp-ts/lib/Task"; import * as TE from "fp-ts/lib/TaskEither"; import { TaskEither } from "fp-ts/lib/TaskEither"; import { RejectionReasonEnum } from "@pagopa/io-functions-commons/dist/generated/definitions/RejectionReason"; +import { Ttl } from "@pagopa/io-functions-commons/dist/src/utils/cosmosdb_model_ttl"; import { SpecialServiceCategoryEnum } from "../generated/api-admin/SpecialServiceCategory"; import { LegalData } from "../generated/definitions/LegalData"; import { PaymentData } from "../generated/definitions/PaymentData"; @@ -429,30 +430,22 @@ export const getProcessMessageHandler = ({ if (O.isNone(maybeProfile)) { // the recipient doesn't have any profile yet - await pipe( - messageStatusUpdater({ - rejection_reason: RejectionReasonEnum.USER_NOT_FOUND, - status: RejectedMessageStatusValueEnum.REJECTED - }), - TE.getOrElse(e => { - context.log.error( - `${logPrefix}|PROFILE_NOT_FOUND|UPSERT_STATUS=REJECTED|ERROR=${JSON.stringify( - e - )}` - ); - throw new Error( - "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" - ); - }) - )(); + // if the user is enabled for feature flag we want to execute the new code if ( isUserEligibleForNewFeature(newMessageWithoutContent.fiscalCode) ) { await pipe( - lMessageStatusModel.updateTTLForAllVersions( - [newMessageWithoutContent.id], - TTL_FOR_USER_NOT_FOUND + messageStatusUpdater({ + rejection_reason: RejectionReasonEnum.USER_NOT_FOUND, + status: RejectedMessageStatusValueEnum.REJECTED, + ttl: TTL_FOR_USER_NOT_FOUND as Ttl + }), + TE.chain(() => + lMessageStatusModel.updateTTLForAllVersions( + [newMessageWithoutContent.id], + TTL_FOR_USER_NOT_FOUND + ) ), TE.map(updatedCount => { if (updatedCount === 0) { @@ -513,8 +506,34 @@ export const getProcessMessageHandler = ({ }) ) ), - TE.mapLeft(_ => { - throw new Error("Error while setting ttl"); + TE.getOrElse(e => { + context.log.error( + `${logPrefix}|PROFILE_NOT_FOUND|UPSERT_STATUS=REJECTED|ERROR=${JSON.stringify( + e + )}` + ); + throw new Error( + "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" + ); + }) + )(); + // if the user is not enabled for feature flag we just execute the messageStatusUpdater without the ttl + } else { + await pipe( + messageStatusUpdater({ + rejection_reason: RejectionReasonEnum.USER_NOT_FOUND, + status: RejectedMessageStatusValueEnum.REJECTED + }), + // eslint-disable-next-line + TE.getOrElse(e => { + context.log.error( + `${logPrefix}|PROFILE_NOT_FOUND|UPSERT_STATUS=REJECTED|ERROR=${JSON.stringify( + e + )}` + ); + throw new Error( + "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" + ); }) )(); } From 652a70e868277fd6aa072670cad42176c1ebeefc Mon Sep 17 00:00:00 2001 From: garma00 Date: Fri, 18 Nov 2022 16:29:22 +0100 Subject: [PATCH 3/8] Update fn-commons and fix ttl type --- .../__tests__/handler.test.ts | 26 +++++++++---------- ProcessMessage/__tests__/handler.test.ts | 3 +-- ProcessMessage/handler.ts | 9 ++----- package.json | 2 +- yarn.lock | 8 +++--- 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/OnFailedProcessMessage/__tests__/handler.test.ts b/OnFailedProcessMessage/__tests__/handler.test.ts index 582023cf..58d673c2 100644 --- a/OnFailedProcessMessage/__tests__/handler.test.ts +++ b/OnFailedProcessMessage/__tests__/handler.test.ts @@ -45,19 +45,19 @@ const aCreatedMessageEvent: CreatedMessageEvent = { beforeEach(() => { jest.clearAllMocks(); // Mock getMessageStatusUpdater - getMessageStatusUpdaterMock.mockImplementation(( - _messageStatusModel: MS.MessageStatusModel, - messageId: NonEmptyString, - fiscalCode: FiscalCode - // status type does not match anymore for some reason - ) => (status: any) => - TE.right({ - ...aRetrievedMessageStatus, - id: messageId, - messageId, - ...status, - fiscalCode - }) + getMessageStatusUpdaterMock.mockImplementation( + ( + _messageStatusModel: MS.MessageStatusModel, + messageId: NonEmptyString, + fiscalCode: FiscalCode + ) => (status: Parameters[0]) => + TE.right({ + ...aRetrievedMessageStatus, + id: messageId, + messageId, + ...status, + fiscalCode + }) ); getQueryIteratorMock.mockImplementation(() => { const asyncIterable = { diff --git a/ProcessMessage/__tests__/handler.test.ts b/ProcessMessage/__tests__/handler.test.ts index c1cd9f10..79d31d9b 100644 --- a/ProcessMessage/__tests__/handler.test.ts +++ b/ProcessMessage/__tests__/handler.test.ts @@ -278,8 +278,7 @@ beforeEach(() => { messageId: NonEmptyString, fiscalCode: FiscalCode ) => - // status type does not match anymore for some reason - jest.fn((status: any) => + jest.fn((status: Parameters[0]) => TE.right({ _etag: "a", _rid: "a", diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index afcf477f..fc71f8e6 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -1,7 +1,6 @@ /* eslint-disable max-lines-per-function */ import { Context } from "@azure/functions"; -import * as t from "io-ts"; import { BlockedInboxOrChannelEnum } from "@pagopa/io-functions-commons/dist/generated/definitions/BlockedInboxOrChannel"; import { EUCovidCert } from "@pagopa/io-functions-commons/dist/generated/definitions/EUCovidCert"; import { FiscalCode } from "@pagopa/io-functions-commons/dist/generated/definitions/FiscalCode"; @@ -352,12 +351,8 @@ const createMessageOrThrow = async ( } }; -// ttl can only be a positive integer or -1 -const ttlType = t.union([NonNegativeInteger, t.literal(-1)]); -type TtlType = t.TypeOf; - export interface IProcessMessageHandlerInput { - readonly TTL_FOR_USER_NOT_FOUND: TtlType; + readonly TTL_FOR_USER_NOT_FOUND: Ttl; readonly isUserEligibleForNewFeature: (fc: FiscalCode) => boolean; readonly lActivation: ActivationModel; readonly lProfileModel: ProfileModel; @@ -439,7 +434,7 @@ export const getProcessMessageHandler = ({ messageStatusUpdater({ rejection_reason: RejectionReasonEnum.USER_NOT_FOUND, status: RejectedMessageStatusValueEnum.REJECTED, - ttl: TTL_FOR_USER_NOT_FOUND as Ttl + ttl: TTL_FOR_USER_NOT_FOUND }), TE.chain(() => lMessageStatusModel.updateTTLForAllVersions( diff --git a/package.json b/package.json index 2fe5c760..5a648b16 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "dependencies": { "@azure/cosmos": "^3.17.1", "@pagopa/express-azure-functions": "^2.0.0", - "@pagopa/io-functions-commons": "^26.2.0", + "@pagopa/io-functions-commons": "^26.2.1", "@pagopa/ts-commons": "^10.10.0", "applicationinsights": "^1.7.4", "azure-storage": "^2.10.4", diff --git a/yarn.lock b/yarn.lock index 3b707dbf..533f7af5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -751,10 +751,10 @@ resolved "https://registry.yarnpkg.com/@pagopa/express-azure-functions/-/express-azure-functions-2.0.0.tgz#eb52a0b997d931c1509372e2a9bea22a8ca85c17" integrity sha512-IFZqtk0e2sfkMZIxYqPORzxcKRkbIrVJesR6eMLNwzh1rA4bl2uh9ZHk1m55LNq4ZmaxREDu+1JcGlIaZQgKNQ== -"@pagopa/io-functions-commons@^26.2.0": - version "26.2.0" - resolved "https://registry.yarnpkg.com/@pagopa/io-functions-commons/-/io-functions-commons-26.2.0.tgz#f828075f78ee57b9ca73956cb35a77652835df48" - integrity sha512-6GMivFVaY343bA8Otx+JsCkUfK18xvF9YA4UxFNf3uxkHwvtGprZCKdIRBa4Y+pKdFZMZrcXIXHv/GcuckBQSw== +"@pagopa/io-functions-commons@^26.2.1": + version "26.2.1" + resolved "https://registry.yarnpkg.com/@pagopa/io-functions-commons/-/io-functions-commons-26.2.1.tgz#82975563db316b12aa539a163dff7a14d8773f3e" + integrity sha512-k3K8Fur7gMOG1+d9ckVOjem8ARRSV8FXII2uWH96SN0gcDJuiQYhwlAUYBJhlPDm/s0TlC9r2RdZRXaiUaZFTQ== dependencies: "@azure/cosmos" "^3.17.1" "@pagopa/ts-commons" "^10.9.0" From c29a4a19917f7f582ac8867142cb4f8a340dc031 Mon Sep 17 00:00:00 2001 From: garma00 Date: Mon, 21 Nov 2022 11:03:16 +0100 Subject: [PATCH 4/8] Split error handling for messageStatusUpdater and updateTTLForAllVersions --- ProcessMessage/__tests__/handler.test.ts | 8 ++----- ProcessMessage/handler.ts | 30 +++++++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ProcessMessage/__tests__/handler.test.ts b/ProcessMessage/__tests__/handler.test.ts index 79d31d9b..b8e3e826 100644 --- a/ProcessMessage/__tests__/handler.test.ts +++ b/ProcessMessage/__tests__/handler.test.ts @@ -882,9 +882,7 @@ describe("getprocessMessageHandler", () => { await expect( processMessageHandler(context, JSON.stringify(aCreatedMessageEvent)) - ).rejects.toThrow( - "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" - ); + ).rejects.toThrow("Error while setting the ttl"); }); it("it should throw an error if the set of ttl on message status fails", async () => { @@ -917,8 +915,6 @@ describe("getprocessMessageHandler", () => { await expect( processMessageHandler(context, JSON.stringify(aCreatedMessageEvent)) - ).rejects.toThrow( - "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" - ); + ).rejects.toThrow("Error while setting the ttl"); }); }); diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index fc71f8e6..2ed5c36c 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -436,6 +436,26 @@ export const getProcessMessageHandler = ({ status: RejectedMessageStatusValueEnum.REJECTED, ttl: TTL_FOR_USER_NOT_FOUND }), + TE.mapLeft((err: CosmosErrors) => { + telemetryClient.trackEvent({ + name: "api.messages.create.create-status-fail", + properties: { + errorKind: "messageStatusUpdater failed", + fiscalCode: toHash(newMessageWithoutContent.fiscalCode), + messageId: newMessageWithoutContent.id, + senderId: newMessageWithoutContent.senderServiceId + }, + tagOverrides: { samplingEnabled: "false" } + }); + context.log.error( + `${logPrefix}|PROFILE_NOT_FOUND|UPSERT_STATUS=REJECTED|ERROR=${JSON.stringify( + err + )}` + ); + throw new Error( + "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" + ); + }), TE.chain(() => lMessageStatusModel.updateTTLForAllVersions( [newMessageWithoutContent.id], @@ -502,14 +522,8 @@ export const getProcessMessageHandler = ({ ) ), TE.getOrElse(e => { - context.log.error( - `${logPrefix}|PROFILE_NOT_FOUND|UPSERT_STATUS=REJECTED|ERROR=${JSON.stringify( - e - )}` - ); - throw new Error( - "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" - ); + context.log.error(`${logPrefix}|ERROR=${JSON.stringify(e)}`); + throw new Error("Error while setting the ttl"); }) )(); // if the user is not enabled for feature flag we just execute the messageStatusUpdater without the ttl From 2c08ed7edbbf703ae860d4c570622be51d3fa3cd Mon Sep 17 00:00:00 2001 From: garma00 Date: Mon, 21 Nov 2022 11:05:11 +0100 Subject: [PATCH 5/8] Remove customEvent in case of 0 elements updated --- ProcessMessage/handler.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index 2ed5c36c..c4dad654 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -462,22 +462,6 @@ export const getProcessMessageHandler = ({ TTL_FOR_USER_NOT_FOUND ) ), - TE.map(updatedCount => { - if (updatedCount === 0) { - telemetryClient.trackEvent({ - name: "api.messages.create.update-status-ttl-count-zero", - properties: { - errorKind: - "updateTTLForAllVersions updated zero documents", - fiscalCode: toHash(newMessageWithoutContent.fiscalCode), - messageId: newMessageWithoutContent.id, - senderId: newMessageWithoutContent.senderServiceId - }, - tagOverrides: { samplingEnabled: "false" } - }); - } - return updatedCount; - }), TE.mapLeft((error: CosmosErrors) => { telemetryClient.trackEvent({ name: "api.messages.create.fail-status-ttl-set", From 1cd021e1c7454755824532139eb339c2ef34c649 Mon Sep 17 00:00:00 2001 From: garma00 Date: Mon, 21 Nov 2022 14:22:43 +0100 Subject: [PATCH 6/8] Modify log message error --- ProcessMessage/handler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index c4dad654..9e284ef5 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -506,7 +506,11 @@ export const getProcessMessageHandler = ({ ) ), TE.getOrElse(e => { - context.log.error(`${logPrefix}|ERROR=${JSON.stringify(e)}`); + context.log.error( + `${logPrefix}|PROFILE_NOT_FOUND|UPSERT_STATUS=REJECTED|ERROR=${JSON.stringify( + e + )}` + ); throw new Error("Error while setting the ttl"); }) )(); From efc8fffe41b62e0b12c2bf4ce3c2f8ac0b7b9919 Mon Sep 17 00:00:00 2001 From: garma00 Date: Mon, 21 Nov 2022 14:30:02 +0100 Subject: [PATCH 7/8] Merge in a single chain the handling of the updateTTLForAllVersions --- ProcessMessage/handler.ts | 41 ++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index 9e284ef5..f3473629 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -456,26 +456,31 @@ export const getProcessMessageHandler = ({ "Error while updating message status to REJECTED|PROFILE_NOT_FOUND" ); }), - TE.chain(() => - lMessageStatusModel.updateTTLForAllVersions( - [newMessageWithoutContent.id], - TTL_FOR_USER_NOT_FOUND + TE.chain( + flow( + () => + lMessageStatusModel.updateTTLForAllVersions( + [newMessageWithoutContent.id], + TTL_FOR_USER_NOT_FOUND + ), + TE.mapLeft((error: CosmosErrors) => { + telemetryClient.trackEvent({ + name: "api.messages.create.fail-status-ttl-set", + properties: { + errorAsJson: JSON.stringify(error), + errorKind: error.kind, + fiscalCode: toHash( + newMessageWithoutContent.fiscalCode + ), + messageId: newMessageWithoutContent.id, + senderId: newMessageWithoutContent.senderServiceId + }, + tagOverrides: { samplingEnabled: "false" } + }); + return error; + }) ) ), - TE.mapLeft((error: CosmosErrors) => { - telemetryClient.trackEvent({ - name: "api.messages.create.fail-status-ttl-set", - properties: { - errorAsJson: JSON.stringify(error), - errorKind: error.kind, - fiscalCode: toHash(newMessageWithoutContent.fiscalCode), - messageId: newMessageWithoutContent.id, - senderId: newMessageWithoutContent.senderServiceId - }, - tagOverrides: { samplingEnabled: "false" } - }); - return error; - }), TE.chain(() => pipe( lMessageModel.patch( From 7735eefffc80ca0940967b649972678c2bdbdd94 Mon Sep 17 00:00:00 2001 From: garma00 Date: Mon, 21 Nov 2022 14:48:20 +0100 Subject: [PATCH 8/8] add error details in case of messageStatusUpdater fails --- ProcessMessage/handler.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ProcessMessage/handler.ts b/ProcessMessage/handler.ts index f3473629..c89d1b09 100644 --- a/ProcessMessage/handler.ts +++ b/ProcessMessage/handler.ts @@ -440,6 +440,7 @@ export const getProcessMessageHandler = ({ telemetryClient.trackEvent({ name: "api.messages.create.create-status-fail", properties: { + errorAsJson: JSON.stringify(err), errorKind: "messageStatusUpdater failed", fiscalCode: toHash(newMessageWithoutContent.fiscalCode), messageId: newMessageWithoutContent.id,