We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41cacaf commit 0038dc1Copy full SHA for 0038dc1
src/index.js
@@ -93,11 +93,14 @@ const runDirect = wrap(processTask)
93
.with(secrets, { name: getSecretName })
94
.with(helixStatus);
95
96
-function isSqsEvent(event) {
97
- return Array.isArray(event?.Records);
+function isDirectInvocation(event) {
+ return event
98
+ && typeof event === 'object'
99
+ && !Array.isArray(event?.Records)
100
+ && typeof event?.type === 'string';
101
}
102
103
export const main = async (event, context) => {
- const handler = isSqsEvent(event) ? runSQS : runDirect;
104
+ const handler = isDirectInvocation(event) ? runDirect : runSQS;
105
return handler(event, context);
106
};
0 commit comments