-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
troubles with aws sam cli #118
Comments
Problem 2:
|
Problem 3:
|
I've been trying to use aws-lambda-haskell-runtime with the AWS SAM CLI. I've run into multiple problems. I'll describe them in this issue. I'm new to AWS Lambda and AWS SAM, so you should take this issue with a grain of salt.
Resources
I learned about SAM from the AWS SAM Developer Guide. In particular,
Setup
I've setup an example Haskell application using
aws-lambda-haskell-runtime
. I've usedsam
to generate atemplate.yaml
file, and then edited to match my Haskell application.Here's my
sam
version:I believe I generated my
template.yaml
file with a command likesam init
, but I forget the specifics. You can find an example in the above resources section.My
template.yaml
looks like the following:The one thing to note here is that the value for
Resources.HeyWorldFunction.Properties.Handler
ishandler
. I use this function in my Haskell application.I have a
Makefile
for building this application that is used bysam build
:The only important target here is
build-HeyWorldFunction
(but it is not directly related to this issue).Here is the
.cabal
file for my application.bootstrap.cabal
:Here's my
app/Main.hs
file:This application can be built by running
sam build
. You can find the built application in the current directory at.aws-sam/build/HeyWorldFunction/bootstrap
.Problem 1:
sam local generate-event
leaves out some fields thataws-lambda-haskell-runtime
is expecting(I've sent a PR for this at #119.)
AWS SAM gives you a way to define example events in files, and then run your function passing it an event from a file. AWS SAM provides the command
sam local generate-event
to generate event files. This is described in the document Invoking functions locally.One problem is that the events that
sam local generate-event
generates don't have all the fields thatApiGatewayRequest
is expecting.For instance, here is an example of generating an event, and then the resulting event file:
$ sam local generate-event apigateway aws-proxy --path "hey" > events/event2.json
This generates an API Gateway Lambda proxy event. Here is the resulting event file:
You can run the Haskell application built with
sam build
by running:$ sam local invoke --event ./events/event2.json
If you do this, you'll see errors that
aws-lambda-haskell-runtime
is expecting more fields than are present in the above input event file. For example,aws-lambda-haskell-runtime
expects theextendedRequestId
field, but that is not defined in this event. There are a few other fields like this as well.The text was updated successfully, but these errors were encountered: