This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I am having trouble setting up a WebSocket API Gateway that calls a Lambda function.
These docs say:
Important
For proxy integrations, API Gateway automatically passes the backend output to the caller as the complete payload. There is no integration response.
However, with the following lambda code:
def lambda_handler(event, context):
return {"example": "response"}
I am getting the following error in CloudWatch logs: "Execution failed due to configuration error: Malformed Lambda proxy response"
I tried returning it as a string, which didn't work. Eventually I got something that didn't give an error:
def lambda_handler(event, context):
return {"statusCode": 200}
Which returned an empty message to the client, and no error in CloudWatch. I tried changing the status code to 404
, and it didn't make a difference (still worked), but I set it to None
and that gave an error in CloudWatch again.
This makes very little sense to me because:
- WebSocket messages don't have status codes, that's an HTTP thing.
- The docs specifically say that the output is passed directly through to the caller, so I don't understand why this error is even happening at all.
Does anyone have any insight on what is going on here and the proper way to set this up? Thanks.
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/aws/comment...