Skip to content

Commit

Permalink
change handler export.
Browse files Browse the repository at this point in the history
see if this clears up "exports is not defined in ES module scope". Will figure out exports for testing later
  • Loading branch information
tmclaugh committed Oct 21, 2024
1 parent ce14a4a commit 266cc23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/handlers/CreateEntity/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PutItemCommandOutput> {
async function putEntity(entity: Entity): Promise<PutItemCommandOutput> {
let output: PutItemCommandOutput

const params: PutItemCommandInput = {
Expand All @@ -46,7 +46,7 @@ export async function putEntity(entity: Entity): Promise<PutItemCommandOutput> {
}


export async function handler (event: APIGatewayProxyEvent, _: Context): Promise<APIGatewayProxyResult> {
async function handler (event: APIGatewayProxyEvent, _: Context): Promise<APIGatewayProxyResult> {
LOGGER.info('Received event', { event })

const entity: Entity = JSON.parse(event.body || '{}') // Already validated body at Gateway
Expand All @@ -57,3 +57,5 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise
body: JSON.stringify({'request_id': output.$metadata.requestId}),
}
}

export default handler
6 changes: 4 additions & 2 deletions src/handlers/GetEntity/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,7 +61,7 @@ export async function getEntity(
}


export async function handler (event: APIGatewayProxyEvent, _: Context): Promise<APIGatewayProxyResult> {
async function handler (event: APIGatewayProxyEvent, _: Context): Promise<APIGatewayProxyResult> {
LOGGER.info('Received event', { event })

const namespace = event.pathParameters?.namespace as string
Expand All @@ -80,3 +80,5 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise
body: JSON.stringify(entity),
}
}

export default handler

0 comments on commit 266cc23

Please sign in to comment.