Skip to content
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

Sample codes local api return Internal server error #89

Closed
pretxel opened this issue Aug 23, 2017 · 2 comments
Closed

Sample codes local api return Internal server error #89

pretxel opened this issue Aug 23, 2017 · 2 comments

Comments

@pretxel
Copy link

pretxel commented Aug 23, 2017

When I run the sample codes about API Gateway https://github.com/awslabs/aws-sam-local/tree/master/samples/api-event-source

I have unexpected error in the response.
Firstly run the API with sam local start-api

2017/08/23 13:11:45 Connected to Docker 1.30
2017/08/23 13:11:45 Successfully parsed template.yml
2017/08/23 13:11:45 Fetching lambci/lambda:nodejs6.10 image for nodejs6.10 runtime...
nodejs6.10: Pulling from lambci/lambda
Digest: sha256:4e6a92d033a1a1e0c580bc66caea4a892256479c611cecafa19e6e29e2a9cb62
Status: Image is up to date for lambci/lambda:nodejs6.10

Mounting static files from /Users/ktb-ot226/ktbo/python/nodeSAM at /
Mounting index.handler (nodejs6.10) at http://127.0.0.1:3000/ [OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT]

You can now browse to the above endpoints to invoke your functions.
You do not need to restart/reload SAM CLI while working on your functions,
changes will be reflected instantly/automatically. You only need to restart
SAM CLI if you update your AWS SAM template.

then execute this curl http://localhost:3000/ and response

{ "message": "Internal server error" }

the api local show

2017/08/23 13:15:38 Invoking index.handler (nodejs6.10)
START RequestId: f0f4521f-1762-114c-0feb-6aad5e501abc Version: $LATEST
2017-08-23T18:15:42.820Z	f0f4521f-1762-114c-0feb-6aad5e501abc	TEST
END RequestId: f0f4521f-1762-114c-0feb-6aad5e501abc
REPORT RequestId: f0f4521f-1762-114c-0feb-6aad5e501abc	Duration: 6.37 ms	Billed Duration: 0 ms	Memory Size: 0 MB	Max Memory Used: 28 MB
2017/08/23 13:15:49 Function index.handler timed out after 3 seconds

I don't know why if the correct response is

"This is a LIST operation, return all products"

I have sam version 0.2.0 and Docker version 17.06.1-ce, build 874a737

Any idea?

@sanathkr
Copy link
Contributor

I am not able to repro this problem. It works fine for me. For some reason the function didnt' complete execution, which is weird given the handler does nothing but directly return.

Can you try again? There is a newer version of the Docker container (Digest: sha256:b9a57b98dcfe226cac3fb0b8329594eefb62ba7089fa27cf8ac968e5736cc04a) published now. May be there was something wrong in the earlier version

@pretxel
Copy link
Author

pretxel commented Aug 29, 2017

I updated the container and it's correct, I retrieve the expected response.
Thanks, Regards.

@pretxel pretxel closed this as completed Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants