Skip to content

Commit

Permalink
Named export for poller lambda handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
bryophyta committed Dec 23, 2024
1 parent 981d7ca commit 4c36f25
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cdk/lib/constructs/pollerLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class PollerLambda {
},
memorySize: pollerConfig.overrideLambdaMemoryMB ?? 128,
timeout,
handler: `index.${pollerId}`, // see programmatically generated exports in poller-lambdas/src/index.ts
handler: `index.handlers.${pollerId}`, // see programmatically generated exports in poller-lambdas/src/index.ts
fileName: `poller-lambdas.zip`, // shared zip for all the poller-lambdas
});

Expand Down
2 changes: 1 addition & 1 deletion poller-lambdas/localRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
POLLERS_CONFIG,
} from '../shared/pollers';
import { sqs } from './src/aws';
import handlers from './src/index';
import { handlers } from './src/index';
import type { HandlerInputSqsPayload } from './src/types';

const fakeInvoke = async (
Expand Down
3 changes: 1 addition & 2 deletions poller-lambdas/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ const pollerWrapper =
}
};

// eslint-disable-next-line import/no-default-export -- we need this to expose the pollers as named handlers but the shape verified with 'satisfies' keyword
export default {
export const handlers = {
EXAMPLE_long_polling: pollerWrapper(EXAMPLE_long_polling),
EXAMPLE_fixed_frequency: pollerWrapper(EXAMPLE_fixed_frequency),
} satisfies Record<
Expand Down

0 comments on commit 4c36f25

Please sign in to comment.