Skip to content

Commit c625293

Browse files
fix: Check if handler exists
1 parent 9936412 commit c625293

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/nodeWorkerRunner.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
import { createRequire as topLevelCreateRequire } from 'module';
23
// eslint-disable-next-line @typescript-eslint/no-unused-vars
34
const require = topLevelCreateRequire(import.meta.url);
@@ -15,6 +16,12 @@ parentPort.on('message', async (data) => {
1516
const mod = await import(workerData.artifactFile);
1617
const fn = mod[workerData.handler];
1718

19+
if (!fn) {
20+
throw new Error(
21+
`Handler '${workerData.handler}' not found for function '${workerData.functionId}'`,
22+
);
23+
}
24+
1825
try {
1926
const context = {
2027
...data.context,

0 commit comments

Comments
 (0)