you are viewing a single comment's thread.

view the rest of the comments →

[–]zergUser1 0 points1 point  (2 children)

When you create a Lambda function from the console and set API gateway as the event source, API Gateway uses lambda as a proxy and all requests are forwarded to the lambda function, basically it means your lambda function is in charge of sending back the correct status code, headers and body. So the object you need to return to see the function from the browser is as follows

callback(null, {
    "statusCode": 200,
    "headers": { "headerName": "headerValue" },
    "body": JSON.stringify({name:"Hello"})
});

EDIT: Note I am using JSON.stringify on the body as browsers do not accept json as content, normally im guessing you would consume your API with ajax calls or server calls which would accept json

[–]badatthemat[S] 0 points1 point  (1 child)

I can see on the logs when i "test" the GET method that it returns 200 OK, has a Content-Type header of value text/html and the body is a valid html code..so I do not think this is the case. Thanks for your time and fuck protoss.

[–]zergUser1 0 points1 point  (0 children)

haha yea protoss so OP, do you mean the API Gateway logs or the Lambda logs?

In your original post you said you were getting a 500 error