Knowledge Center Monthly Newsletter - March 2025
Stay up to date with the latest from the Knowledge Center. See all new and updated Knowledge Center articles published in the last month and re:Post’s top contributors.
我想对在向我的 Amazon API Gateway WebSocket API 发布消息时出现的“410 GoneException”错误进行故障排除。
由于以下原因,您可能会收到“410 GoneException”错误:
**注意:**对于 WebSocket API,需要使用 connectionId 才能从后端发送回调响应。
要对 WebSocket API 错误进行故障排除,请开启 Amazon CloudWatch Logs。对于 Log level(日志级别),选择 Info(信息)以针对所有请求生成执行日志。执行日志包含可用于识别多数 API 错误和对其进行故障排除的信息。例如:
有关详细信息,请参阅用于 API Gateway 的 CloudWatch 日志格式。
要建立连接,请在向 WebSocket API 发布消息之前,使用 AWS SDK ApiGatewayManagementApi 调用 getConnection 操作。
请勿从与您的 $connect 路由集成的 Lambda 函数发出 postToConnection 请求。要在建立客户端连接后发布消息,请完成以下步骤:
API Gateway 中的 WebSocket API 概览
如何将 connectionId 或自定义令牌作为 API Gateway WebSocket API 的标头传递给 VPC 链接集成?