-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction-d.ts
More file actions
33 lines (28 loc) · 820 Bytes
/
function-d.ts
File metadata and controls
33 lines (28 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {
type DurableContext,
withDurableExecution,
} from "@aws/durable-execution-sdk-js";
export const handler = withDurableExecution(
async (_event: unknown, context: DurableContext) => {
if (
!process.env.FUNCTION_A_ARN ||
!process.env.FUNCTION_B_ARN ||
!process.env.FUNCTION_C_ARN
) {
throw new Error("Missing environment variables");
}
// the execution of function-d is suspended until function-a completes!
await context.invoke("invoke-function-a", process.env.FUNCTION_A_ARN, {
data: { name: "Function D" },
});
await context.invoke("invoke-function-b", process.env.FUNCTION_B_ARN, {
data: { name: "Function D" },
});
await context.invoke("invoke-function-c", process.env.FUNCTION_C_ARN, {
data: { name: "Function D" },
});
return {
status: 200,
};
},
);