I tried to connect to my Amazon API Gateway WebSocket API but I received errors. How do I troubleshoot my WebSocket API connection?
API Gateway WebSocket API connection errors might occur due to:
Follow these troubleshooting steps for your use case.
API Gateway uses IAM roles, policies, tags, and AWS Lambda authorizers to control access to a WebSocket API. For more information, see Controlling and managing access to a WebSocket API in API Gateway.
Also, make sure that the WebSocket API integration request is configured correctly.
In this example request URL, make sure that the following fields are correct:
Follow the instructions to turn on Amazon CloudWatch logs for troubleshooting API Gateway WebSocket APIs. If a Lambda function is integrated for the backend, check the CloudWatch logs for errors. For more information, see Accessing CloudWatch logs for AWS Lambda.
If IAM authentication is turned on, then make sure that the API request is signed with Signature Version 4 (SigV4). For more information, see Signing AWS requests with Signature Version 4.
To turn on IAM authentication for your API Gateway API, follow these steps:
Monitoring WebSocket API execution with CloudWatch metrics
Use API Gateway Lambda authorizers
How do I troubleshoot HTTP 403 Forbidden errors when using a Lambda authorizer with an API Gateway REST API?
How do I troubleshoot issues when connecting to an API Gateway private API endpoint?