gpt4 book ai didi

amazon-web-services - AWS API 网关 WebSocket 连接错误

转载 作者:行者123 更新时间:2023-12-03 23:52:55 26 4
gpt4 key购买 nike

我通过 AWS API Gateway 和 Lambda 创建了一个相同的 API ' https://github.com/aws-samples/simple-websockets-chat-app '。但是 API 不信任。当我尝试连接时出现错误。它的消息是“与 'wss://b91xftxta9.execute-api.eu-west-1.amazonaws.com/dev' 的 WebSocket 连接失败:WebSocket 握手期间出错:意外响应代码:500”

我的连接代码

var ws= new WebSocket("wss://b91xftxta9.execute-api.eu-west-1.amazonaws.com/dev");
ws.onopen=function(d){
console.log(d);
}

最佳答案

尝试添加 $context.error.validationErrorString $context.integrationErrorMessage 到舞台的日志。
我在 上加了一堆东西日志格式 部分,像这样:

{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp",
"requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod",
"routeKey":"$context.routeKey", "status":"$context.status",
"protocol":"$context.protocol", "errorMessage":"$context.error.message",
"path":"$context.path",
"authorizerPrincipalId":"$context.authorizer.principalId",
"user":"$context.identity.user", "caller":"$context.identity.caller",
"validationErrorString":"$context.error.validationErrorString",
"errorResponseType":"$context.error.responseType",
"integrationErrorMessage":"$context.integrationErrorMessage",
"responseLength":"$context.responseLength" }
在早期开发中,这让我看到了这种类型的错误:
{
"requestId": "QDu0QiP3oANFPZv=",
"ip": "76.54.32.210",
"requestTime": "21/Jul/2020:21:37:31 +0000",
"httpMethod": "POST",
"routeKey": "$default",
"status": "500",
"protocol": "HTTP/1.1",
"integrationErrorMessage": "The IAM role configured on the integration
or API Gateway doesn't have permissions to call the integration.
Check the permissions and try again.",
"responseLength": "35"
}

关于amazon-web-services - AWS API 网关 WebSocket 连接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54761176/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com