Closed lrworth closed 4 years ago
Hey, thanks for pointing this out!
This for sure is important. Yes, the 80% of the cases are JSON-formatted bodies, but it is necessary to support the other 20%. What did you do in your fork?
I added
newtype RawApiGatewayRequest = RawApiGatewayRequest (ApiGatewayRequest Text)
with a different FromJSON instance, and exported LambdaError
and RunCallback
so I could write my own main
rather than using the TH-generated one. (The generated one bakes in JSON decoding).
Well, I made a PR anyway!
I see, let's discuss over there!
This was added on version 3.0.0, closing this
We are trying to deploy a SAM app to respond to Slack slash-commands. When you deploy a
AWS::Serverless::Function
with anApi
event source, you get an API Gateway with a proxy lambda — so HTTP POST requests are relayed verbatim to the Lambda underapiGatewayRequestBody
. Slack posts parameters asapplication/x-www-form-urlencoded
, butApiGatewayRequest
's FromJSON instance requires the body to be JSON-formatted.This all means that there is no (simple) way to use
aws-lambda-haskell-runtime
with AWS SAM to receive the Slack payload. I've forked this repository to add the functionality I need, but I am not convinced my solution will work for everyone so I'm not willing to submit a PR yet.