下面是我从API网关自动生成的javascript SDK返回的错误。
{
"data": "",
"status": 0,
"statusText": "",
"headers": {
},
"config": {
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json",
"x-amz-date": "20180127T231842Z",
"Authorization": "AWS4-HMAC-SHA256 Credential=.....",
"x-amz-security-token": "....."
},
"timeout": 0,
"transformRequest": [null],
"transformResponse": [null],
"url": "https://somevalues.execute-api.us-west-2.amazonaws.com/env/some/path",
"data": "{\"startDay\":0,\"endDay\":1}"
}
}
我查看了我的cloudwatch日志,呼叫成功。我将API网关绑定到AWS lambda,作为一个无服务器的函数设置。
我从未见过这种类型的错误,但今天我得到了5个。随后的通话都正常。
编辑:这可能与CORS设置有关吗?API网关似乎每隔一段时间就会出现问题,并且不会发回相应的COR。可能是在功能冷的时候,也许?我不确定。。。
编辑2:我刚刚验证了-我所有的OPTIONSendpoint(用于CORS)都不需要auth或api密钥。所以我不认为是这样。
编辑4:编辑3是错误的,我击中了错误的endpoint。使用curl点击我的API选项endpoint可以正常工作。
编辑5:查看cloudwatch中的API网关日志,下面是它们的样子。。。在这一点上完全迷失了方向。
[32m/aws/lambda/supercoolsoftware-prod-createInviteCode[0m [36m2018/02/26/[$LATEST]8578bb59ab0538558fabef7bd1f484a2[0m START RequestId: e3g4f130-1b35-11e8-b0cf-e7f75f2e4dc1 Version: $LATEST
[32m/aws/lambda/supercoolsoftware-prod-createInviteCode[0m [36m2018/02/26/[$LATEST]8578bb59ab0538558fabef7bd1f484a2[0m END RequestId: e3g4f130-1b35-11e8-b0cf-e7f75f2e4dc1
[32m/aws/lambda/supercoolsoftware-prod-createInviteCode[0m [36m2018/02/26/[$LATEST]8578bb59ab0538558fabef7bd1f484a2[0m REPORT RequestId: e3g4f130-1b35-11e8-b0cf-e7f75f2e4dc1 Duration: 10007.96 ms Billed Duration: 10000 ms Memory Size: 128 MB Max Memory Used: 51 MB
[32m/aws/lambda/supercoolsoftware-prod-createInviteCode[0m [36m2018/02/26/[$LATEST]8578bb59ab0538558fabef7bd1f484a2[0m 2018-02-26T20:44:58.994Z e3g4f130-1b35-11e8-b0cf-e7f75f2e4dc1 Task timed out after 10.01 seconds
编辑6:它还显示了10000毫秒的集成延迟。。。。
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Verifying Usage Plan for request: e2f406ec-1b35-11e8-bce8-e3c6368e1bfc. API Key: API Stage: xxxxxxxxxx/prod
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) API Key authorized because method 'POST /accounts/inviteCode' does not require API Key. Request will not contribute to throttle or quota limits
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Usage Plan check succeeded for API Key and API Stage xxxxxxxxxx/prod
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Starting execution for request: e2f406ec-1b35-11e8-bce8-e3c6368e1bfc
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) HTTP Method: POST, Resource Path: /accounts/inviteCode
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Method request path: {}
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Method request query string: {}
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Method request headers: {Accept=application/json, x-amz-date=20180226T204447Z, CloudFront-Viewer-Country=US, CloudFront-Forwarded-Proto=https, CloudFront-Is-Tablet-Viewer=false, origin=https://app.supercoolsoftware.io, CloudFront-Is-Mobile-Viewer=false, Referer=https://app.supercoolsoftware.io/devices, User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36, X-Forwarded-Proto=https, CloudFront-Is-SmartTV-Viewer=false, Host=xxxxxxxxxx.execute-api.us-west-2.amazonaws.com, Accept-Encoding=gzip, deflate, br, dnt=1, x-amz-security-token=FQoDYXdzEK7//////////wEaDFrfZM8Y6J3xvLiS2iKTBF5YIv8VFsraozz/AxRzj10S9RzrOoJTswlhoOfX/gfGYPWP5PNQ1ue7IHEUeUpm+ewB5wANsbydmqGQzVCCvIZkYq+/1X0Iqr74rFuUWBO8ATrKtXBz7zJzpmLtXaOaIzwlFwq/6cKvh4r8HLvSjxBAG4H+ayyUU1IDKmUKAVtpCDvk9FUJM7D5zm4Wlt/yu8/dc3F4a8ID0it93GTQSSi/1YaDmGrkEJ3ySxxE0O0TAZzV50Yprj2gkOX4zNuPsQfWGenILaAog6FLw4asv1J+lE6zKgJtpSiYXyASf54jWnUT4VSiuHL2zU0p1B3tn/wkLF14dCS/IhzAtBgxpqGcRiqy6S05l3MsXJl3WHxMt1iSu5yNLLy2wjlg9j2BoEs18ravB [TRUNCATED]
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Method request body before transformations: {"deviceType":"USER","deviceName":"Me"}
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Endpoint request URI: https://lambda.us-west-2.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-west-2:122312312312:function:supercoolsoftware-prod-createInviteCode/invocations
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Endpoint request headers: {x-amzn-lambda-integration-tag=e2f406ec-1b35-11e8-bce8-e3c6368e1bfc, Authorization=*******************************************************************************************************************************************************************************************************************************************************************************************************e57bd5, X-Amz-Date=20180226T204448Z, x-amzn-apigateway-api-id=xxxxxxxxxx, Accept=application/json, User-Agent=AmazonAPIGateway_xxxxxxxxxx, X-Amz-Security-Token=FQoDYXdzEK7//////////wEaDHJUDFmtbGGy6Q/bcyKOBn+NX/e9T3+kv8LYDm//MnuArciU8olgca3VHeUDpqmrYaD7w+RQtnmSVQvZ8VqZw0G13UUxen8Ppageped//Yq3QPOEAjLLPICkaplSQh//iDYHYcjEOcrSY/IdeNelF+npPONj/+8Yfg7CGjYa+CCIdTwlrygtAzucAkzn0VxmmAsnmbcXbw6OMJJKd9Ujz7xIsTGOo3RaBsgGfkxHVA/OtMTNEACCWu2KAus1cFxf+gJxVCS2lb0QxcA7dCqc4NyB9cwJXopG5oQSx1sZ8EbJvNcvvHNgumrxpr2qk5hmIJVVhmdqJ3HdZUd+xePNpwtY/pd84Iy7hyjucVX6RIsxfQOd+TYGrgJMIb4hdpAFXGKXlRLfl7E8Dpp5jpOpVW4uRXOvMGVzncUMfJH6ph/YAVPsKn6F [TRUNCATED]
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Endpoint request body after transformations: {"resource":"/accounts/inviteCode","path":"/accounts/inviteCode","httpMethod":"POST","headers":{"Accept":"application/json","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9","CloudFront-Forwarded-Proto":"https","CloudFront-Is-Desktop-Viewer":"true","CloudFront-Is-Mobile-Viewer":"false","CloudFront-Is-SmartTV-Viewer":"false","CloudFront-Is-Tablet-Viewer":"false","CloudFront-Viewer-Country":"US","content-type":"application/json","dnt":"1","Host":"xxxxxxxxxx.execute-api.us-west-2.amazonaws.com","origin":"https://app.supercoolsoftware.io","Referer":"https://app.supercoolsoftware.io/devices","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36","Via":"2.0 cbec82431a010799f206b43dbd0489c3.cloudfront.net (CloudFront)","X-Amz-Cf-Id":"zM1gObCVuZ9UXh_beuWr-o9XomlnGGyYFWEn5HJNGk8cBQOMOSCMEw==","x-amz-date":"20180226T204447Z","x-amz-security-token":"FQoDYXdzEK7//////////wEaDFrfZM8Y6J3xvLiS2iKTBF5YIv8 [TRUNCATED]
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Sending request to https://lambda.us-west-2.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-west-2:122312312312:function:supercoolsoftware-prod-createInviteCode/invocations
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Received response. Integration latency: 10026 ms
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Endpoint response body before transformations: {"errorMessage":"2018-02-26T20:44:58.994Z e2f4f130-1b35-11e8-b0cf-e7f75f2e4dc1 Task timed out after 10.01 seconds"}
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Endpoint response headers: {X-Amz-Executed-Version=$LATEST, x-amzn-Remapped-Content-Length=0, Connection=keep-alive, x-amzn-RequestId=e2f4f130-1b35-11e8-b0cf-e7f75f2e4dc1, Content-Length=115, X-Amz-Function-Error=Unhandled, Date=Mon, 26 Feb 2018 20:44:58 GMT, X-Amzn-Trace-Id=root=1-5a9471c0-0b361380a48e2bc0743673a5;sampled=0, Content-Type=application/json}
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Execution failed due to configuration error: Malformed Lambda proxy response
[32mAPI-Gateway-Execution-Logs_xxxxxxxxxx/prod[0m [36m69adc1e107f7f7d035d7baf04342e1ca[0m (e2f406ec-1b35-11e8-bce8-e3c6368e1bfc) Method completed with status: 502
编辑7:我写的每个函数的开头都是这样的。。。
module.exports.unsubscribeFromDailyEmails = function(event, context, cb) {
logRequest(event, context);
//more logic
function logRequest(event, context) {
console.log('event: ' + JSON.stringify(event));
console.log('context: ' + JSON.stringify(context));
}
我想强调的是,在我所说的情况下,logRequest函数永远无法实现——没有写入cloud watch的日志。是的,logRequest是我在每个函数中做的第一件事。
编辑8:我在过去的一周左右没有看到这种情况发生...所以也许它在AWS方面并且是固定的?如果我发现其他情况,我会更新的。
编辑9:我现在已经看到,由于抛出异常而未处理,这种情况会发生在其他一些endpoint上。然而,这与10000集成延迟错误并不相同。
希望您指的是自定义状态代码,而不是http状态代码。如果连接成功,API网关将只返回非零状态代码。要隔离问题,您可以删除此设置中的任何自定义授权程序。大多数情况下,来自定制授权人的拒绝状态将是403禁止状态,但这里似乎有所不同。同时删除根据日志设置的任何基于配额的使用。在我看来,10000的绝对数字似乎是API网关中的一种配置。
我认为你在正确的轨道上,请阅读这篇文章,它会很好地为你铺平道路。点击这里
我已经部署了带有Lambda函数和API网关的AWS堆栈。部署后,我独立测试了Lambda函数,它工作正常,但当我使用AWSAPI网关调用它时,它失败了` 内部错误:502 我看了一下cloudwatch的日志,上面写着 转换前的endpoint响应体:null 我以以下方式返回Lambda(Python 3.6)的响应-
我正在用Netty框架创建一个代理,但我注意到收到的最后一条消息在传递到下一个节点之前往往会延迟。 设计: 客户| 基本上,当服务器在将消息传递给客户机之前启动消息时会出现延迟,或者如果服务器在第一条消息之后立即发送后续消息,那么第一条消息就会通过,第二条消息会延迟几秒钟。为什么会这样?是否缺少一些配置参数?
首先,是否有人对GRPC客户机服务器实现与websocket protobuf客户机服务器实现之间的吞吐量/延迟进行了性能比较?或者至少是类似的东西。 为了实现这一目标,我正在试用示例JAVA helloworld grpc客户机服务器,并尝试将响应的延迟与类似的websocket客户机服务器进行比较。目前,我正在本地机器上用客户端和服务器进行测试。 websocket客户端服务器在服务器端有一个
我目前在react native中有一个函数,它执行以下操作: 我运行上述命令,可以确认arrayId和title变量有效并包含数据。arrayId也不是“selectProduct”。我在调试时在那里添加了一个console.log,以确保它运行,事实上确实如此。我期望的行为是状态立即更新。 但是,所选下拉列表的状态不会更新。在this.setState更新之后添加:console.log(th
我希望Spark 1.6的新mapWithState API几乎可以立即删除超时的对象,但有一个延迟。 我正在使用下面经过修改的JavaStatefulNetworkWordCount版本测试API: 一起nc(
我遇到的大多数集成都使用java-agent将跟踪推送到中央收集器,然后可以在Jaeger中查看跟踪。但是在我的例子中,我不能使用java代理,因此我决定使用自定义跟踪api,这似乎很好,并且有很多这样的例子。 通过设计,我的低延迟应用程序限制了我与外部组件/端口的任何连接,因此我也试图避免将跟踪/跨距推送到本地Jaeger代理或收集器endpoint,而是通过LogReporter记录跟踪。 除