Skip to content

Commit 6764866

Browse files
correct handler function and lint errors
1 parent b51d290 commit 6764866

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lambdas/upsert-letter/src/handler/upsert-handler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
LetterRequestPreparedEventV2,
2020
} from "@nhsdigital/nhs-notify-event-schemas-letter-rendering";
2121
import z from "zod";
22-
import { metricScope, Unit } from "aws-embedded-metrics";
22+
import { Unit, metricScope } from "aws-embedded-metrics";
2323
import { Deps } from "../config/deps";
2424

2525
type SupplierSpec = { supplierId: string; specId: string };
@@ -154,15 +154,18 @@ async function runUpsert(
154154
}
155155

156156
export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
157-
return metricScope(async (metrics) => {
157+
return metricScope((metrics) => {
158158
return async (event: SQSEvent) => {
159+
console.log("The SQSEvent:", event);
159160
const batchItemFailures: SQSBatchItemFailure[] = [];
160161

161162
const tasks = event.Records.map(async (record) => {
162163
try {
163164
const message: string = parseSNSNotification(record);
165+
console.log("the message:", message);
164166

165167
const snsEvent = JSON.parse(message);
168+
console.log("the snsEvent:", snsEvent);
166169

167170
const letterEvent: unknown = removeEventBridgeWrapper(snsEvent);
168171

@@ -189,7 +192,6 @@ export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
189192
// eslint-disable-next-line sonarjs/pseudo-random
190193
OddOrEven: `${Math.floor(Math.random() * 10) % 2}`,
191194
});
192-
metrics.setProperty("operation", operation.name);
193195
metrics.putMetric("MessageFailed", 1, Unit.Count);
194196
batchItemFailures.push({ itemIdentifier: record.messageId });
195197
}

0 commit comments

Comments
 (0)