-
Notifications
You must be signed in to change notification settings - Fork 351
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
Can't get this working with "sam local" #38
Comments
FWIW, I just tried this with |
@radix Ugh, sorry about that. I'm not entirely sure what's causing that. Can you share a minimal example (presumably, what you have) demonstrating the issue and I'll try to see what's up? |
Hey @davidbarsky, I've uploaded my code to https://github.com/radix/pandt/tree/simplified-main-lambda-for-repro there is a SAM.yaml in the root directory. It expects the executable to be at The thing that I am getting super confused about now is that I am even getting this |
There may be a more than one issue going on here but here's the one that jumps out at me. I'm not super sam-savy but I think the part of the answer you're looking for is in how you're applying sam to your usecase based on the log examples above sam local, if I recall, is intended to mount a local http server dispatching to aws lambda functions which expect gateway event's and yield api gateway responses from your logs above
Api gateway, the proxy integration at least, has an expectation that you yield a response of a certain format. From you're example code above, it looks like you aren't meeting those expectations #[derive(Serialize, Debug)]
struct Response {
secret: String,
input_event: Value,
} If you're sticking to a published version of this crate, I'd recommend a structure with body, headers or statusCode as mentioned in the error message or if you don't mind depending on unpublished release there's a new lambda-http module available in master that targets api gateway integrations specifically. This uses the http crate as its core interface but also supports closures and as the more loosely typed rust lambda runtime interfaces support |
@softprops The same thing is happening with |
Heads up. I'm working on bringing first class rust support to Sam aws/aws-lambda-builders#174 |
* Added unit tests for TryFrom<HeaderMap> for Context
👋 Hello! Just noting a proposed fix: #332 |
#332 got merged and it works now, yay! This issue can be closed, IMHO. |
Agreed, closing this as the issue is resolved. Thanks for the contribution @kenshih |
When trying to run my lambda function with
sam local start-api
, I get the following error about_LAMBDA_SERVER_PORT
not being defined:If I set
_LAMBDA_SERVER_PORT
to some random port value like5000
, then it doesn't immediately crash, but then I get a timeout:My function isn't doing anything special:
The text was updated successfully, but these errors were encountered: