aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.64k stars 1.01k forks source link

Chalice and Step Functions integration #291

Closed nedlowe closed 7 years ago

nedlowe commented 7 years ago

Hi,

I want to call my Chalice-based lambdas from Step Functions. Since Chalice groups up multiple functions into a single lambda, I can't call into a specific function using the ARN (which is what the Step Functions Amazon States Language wants).

The only workaround I can think of is writing a new set of lambdas, each of which calls the relevant HTTP endpoint. But obviously going lambda -> API Gateway -> lambda is inefficient...

Presumably Chalice is internally determining which function to call based on data passed from API Gateway - perhaps I could just "fake" that, so the Chalice function thinks the caller is API Gateway...

Am I missing a better way of doing this?

Many thanks, Ned

nedlowe commented 7 years ago

If people are interested - I "faked" the data as mentioned above and got it to work (although its pretty hacky). This is what I sent from the Step Function:

{ "requestContext": {"resourcePath": "/MY_RESOURCE_PATH/{XYZ}", "httpMethod": "POST"}, "pathParameters": {"XYZ": 1234}, "queryStringParameters": {}, "headers": {}, "body": {}, "stageVariables": {} }

stealthycoin commented 7 years ago

This should be doable now with the addition of pure lambda functions.