From 266cc236ed30248af9312a980767260256ac0eaa Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Mon, 21 Oct 2024 19:39:11 -0400 Subject: [PATCH] change handler export. see if this clears up "exports is not defined in ES module scope". Will figure out exports for testing later --- src/handlers/CreateEntity/function.ts | 6 ++++-- src/handlers/GetEntity/function.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/handlers/CreateEntity/function.ts b/src/handlers/CreateEntity/function.ts index 32a2428..63b3242 100644 --- a/src/handlers/CreateEntity/function.ts +++ b/src/handlers/CreateEntity/function.ts @@ -25,7 +25,7 @@ const LOGGER = new Logger() const DDB_CLIENT = new DynamoDBClient() const DDB_TABLE_NAME = process.env.DDB_TABLE_NAME || '' -export async function putEntity(entity: Entity): Promise { +async function putEntity(entity: Entity): Promise { let output: PutItemCommandOutput const params: PutItemCommandInput = { @@ -46,7 +46,7 @@ export async function putEntity(entity: Entity): Promise { } -export async function handler (event: APIGatewayProxyEvent, _: Context): Promise { +async function handler (event: APIGatewayProxyEvent, _: Context): Promise { LOGGER.info('Received event', { event }) const entity: Entity = JSON.parse(event.body || '{}') // Already validated body at Gateway @@ -57,3 +57,5 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise body: JSON.stringify({'request_id': output.$metadata.requestId}), } } + +export default handler \ No newline at end of file diff --git a/src/handlers/GetEntity/function.ts b/src/handlers/GetEntity/function.ts index 1c4c60b..1945828 100644 --- a/src/handlers/GetEntity/function.ts +++ b/src/handlers/GetEntity/function.ts @@ -27,7 +27,7 @@ const DDB_TABLE_NAME = process.env.DDB_TABLE_NAME || '' -export async function getEntity( +async function getEntity( namespace: string, kind: string, name: string @@ -61,7 +61,7 @@ export async function getEntity( } -export async function handler (event: APIGatewayProxyEvent, _: Context): Promise { +async function handler (event: APIGatewayProxyEvent, _: Context): Promise { LOGGER.info('Received event', { event }) const namespace = event.pathParameters?.namespace as string @@ -80,3 +80,5 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise body: JSON.stringify(entity), } } + +export default handler \ No newline at end of file