Websocket API Gateway error "No match for output mapping"

0

Hi,

I am having error in $connect route of my Websocket API Gateway. The setup is very simple with no Authorization and Api key requirement. The integration type is a Lambda Function without using Lambda Proxy Integration. The following is the Lambda function:

public class LambdaBasicStreamFunction implements RequestStreamHandler {
@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
int letter;
String eventObject = "";

    while ((letter = inputStream.read()) > -1) {  
        char inputChar= (char) letter;  
        eventObject += inputChar;  
    }  

    //Passing a custom response as the output string  
    String response = "{\n" +  
            "    \"statusCode\": 200,\n" +  
            "    \"headers\": {\"Content-Type\": \"application/json\"},\n" +  
            "    \"body\": \"plain text response\"\n" +  
            "}";  
    outputStream.write(response.getBytes());  

    System.out.println("Input-Event: " + eventObject);  
}  

}

When I used wscat to test the connection, I got "error: Unexpected server response: 500". The api execution log says: "Execution failed due to configuration error: No match for output mapping and no default output mapping configured. Endpoint Response Status Code: 200".

Can anyone help me figure out the problem? Thanks in advance.

1개 답변
1

Never mind. I found once I enable Lambda Proxy Integration, the error goes away.

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인