Skip to content

Commit 0038dc1

Browse files
committed
fix: direct invoke
1 parent 41cacaf commit 0038dc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ const runDirect = wrap(processTask)
9393
.with(secrets, { name: getSecretName })
9494
.with(helixStatus);
9595

96-
function isSqsEvent(event) {
97-
return Array.isArray(event?.Records);
96+
function isDirectInvocation(event) {
97+
return event
98+
&& typeof event === 'object'
99+
&& !Array.isArray(event?.Records)
100+
&& typeof event?.type === 'string';
98101
}
99102

100103
export const main = async (event, context) => {
101-
const handler = isSqsEvent(event) ? runSQS : runDirect;
104+
const handler = isDirectInvocation(event) ? runDirect : runSQS;
102105
return handler(event, context);
103106
};

0 commit comments

Comments
 (0)