Open seanhess opened 3 years ago
Wait, I had my Main function as a call to runWaiAsLambda, not the generate one, but now that I'm trying to switch to follow your example, I realize that your documentation doesn't match the hackage version. There is no function waiHandler. Can you update the example?
It looks like all your documentation is out of date! There is no generateLambdaDispatcher
function. The error above comes from attempting to get this to work from only the haddocks. How do you get this to work with the new version? Should I downgrade?
The above error happened when I had the following Main.hs. How do you do this correctly with the latest version?
{-# LANGUAGE OverloadedStrings #-}
module Lambda where
import Aws.Lambda.Wai
import Aws.Lambda (defaultDispatcherOptions)
import qualified App
main :: IO ()
main =
runWaiAsLambda
APIGateway
defaultDispatcherOptions
"handler"
App.app -- :: IO Application
This is when the project is configured to use the http api, not the rest api. I was able to get a basic example working simply by switching my project from http to rest.
@seanhess Glad you managed to resolve the issue! The documentation is indeed lacking. Can you open an issue in https://github.com/eir-forsakring/aws-lambda-haskell-runtime-wai?
Perhaps I didn't explain well. This issue is in this repository, it seems that it doesn't support API Gateway Http APIs (As opposed to REST. Http API requests are much cheaper).
It can be reproduced with your simple example, which doesn't use Wai at all, but configure API Gateway to use the http api in place of the rest api.
I get it. We haven't had a use case for that yet, but I'll make a note to implement HTTP API support.
I initially got the same "Unhandled" error with HTTP gateway. It seems there're two supported payload formats ("1.0" and "2.0") for HTTP gateway, see AWS docs. Apparently HTTP gateway by default uses "2.0". REST gateway uses single unnamed format which seems to be the same as "1.0" format for HTTP gateway.
So, setting the format to "1.0" on AWS side seems to make it compatible with aws-lambda-haskell-runtime
and fixes the issue for me. (For clarity, in Terraform I set payload_format_version = "1.0"
for aws_apigatewayv2_integration
resource).
Hi, thanks for your work on this! My lambda is invoked, but it looks like the request never gets to my handler. I'm getting an Internal Server error.
Here's a copy of the log: My haskell program is run and the wai Application is created (I'm using aws-lambda-haskell-runtime-wai). But there are no messages
The Api Gateway log says Unhandled. Does that mean an unhandled exception or a unhandled request?
What am I missing?