Sakar
08/05/2021, 7:14 AMthdxr
08/05/2021, 10:43 AMSakar
08/05/2021, 1:06 PMthdxr
08/05/2021, 1:11 PMconst myFunc = new sst.Function(stack, "myFunc", {
handler: "src/lambda.handler",
})
You can use that in the api routes
routes: {
"GET /": myFunc
}
And then in a sfn invoke tasks.LambdaInvoke(stack, "invoke", { lambdaFunction: myFunc })
However I'm not sure this is a good idea. The payload to this function will be different depending on if it's coming from the API or from the sfn. I'd recommend making separate functions for thisSam Hulick
08/05/2021, 2:47 PMevent
object shapes in the Lambda function if it was called via REST API or Step Function. but it’s doable. if using TypeScript, you could create TypeScript predicates (e.g. isRestPayload
and isSFNPayload
) to expose the proper properties on event
while working on your Lambda codeSam Hulick
08/05/2021, 2:48 PM