From baa95be0d1ba7e71ca534e3b3b4fb45fea147d66 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 4 Jan 2023 22:46:17 +0100 Subject: [PATCH] Fix bug where otel brings down the lambda see https://github.com/open-telemetry/opentelemetry-js-contrib/issues/647 --- .../WebAnalytics/WebAnalytics.CollectEventHandler.ts | 4 +++- .../WebAnalytics/WebAnalytics.GetEventsByMonthHandler.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/analytics/src/constructs/WebAnalytics/WebAnalytics.CollectEventHandler.ts b/analytics/src/constructs/WebAnalytics/WebAnalytics.CollectEventHandler.ts index 713d303..4f4ea32 100644 --- a/analytics/src/constructs/WebAnalytics/WebAnalytics.CollectEventHandler.ts +++ b/analytics/src/constructs/WebAnalytics/WebAnalytics.CollectEventHandler.ts @@ -3,7 +3,7 @@ import { ensureAnalyticsEventInput } from "./model/AnalyticsEventInput"; import { saveEvent } from "./handler/saveEvent"; import { cors } from "@lambda-middleware/cors"; -export const handler: APIGatewayProxyHandler = cors({ +const handler: APIGatewayProxyHandler = cors({ allowedOrigins: [ "http://localhost:3000", "http://localhost:6006", @@ -29,3 +29,5 @@ export const handler: APIGatewayProxyHandler = cors({ body: "", }; }); + +module.exports = { handler }; diff --git a/analytics/src/constructs/WebAnalytics/WebAnalytics.GetEventsByMonthHandler.ts b/analytics/src/constructs/WebAnalytics/WebAnalytics.GetEventsByMonthHandler.ts index 8e699f0..f647662 100644 --- a/analytics/src/constructs/WebAnalytics/WebAnalytics.GetEventsByMonthHandler.ts +++ b/analytics/src/constructs/WebAnalytics/WebAnalytics.GetEventsByMonthHandler.ts @@ -3,7 +3,7 @@ import { aggregateEvents } from "./handler/aggregateEvents"; import { APIGatewayProxyHandler } from "aws-lambda"; import { cors } from "@lambda-middleware/cors"; -export const handler: APIGatewayProxyHandler = cors({ +const handler: APIGatewayProxyHandler = cors({ allowedOrigins: [ "http://localhost:3000", "http://localhost:6006", @@ -17,3 +17,5 @@ export const handler: APIGatewayProxyHandler = cors({ body: JSON.stringify(aggregateEvents(events), null, 2), }; }); + +module.exports = { handler };