Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

0
Websockets API Gateway Lambda proxying help
Post Flair (click to view more posts with a particular flair)
Post Body

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:

  1. WebSocket messages don't have status codes, that's an HTTP thing.
  2. 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.

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
82,785
Link Karma
396
Comment Karma
82,114
Profile updated: 3 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago