amazon-web-services - AWS AppSync 列表查询在控制台和代码中出现 504 错误
问题描述
给定以下架构:
input CreateSurveysInput {
uuid: String!
year: Int!
geocode: AWSJSON!
metadata: AWSJSON!
observations: AWSJSON!
report_url: String
survey_date: String!
video_url: String!
}
input CreateWaterQualityInput {
uuid: String!
}
input DeleteSurveysInput {
uuid: String!
year: Int!
}
input DeleteWaterQualityInput {
uuid: String!
}
type Mutation {
createSurveys(input: CreateSurveysInput!): Surveys
updateSurveys(input: UpdateSurveysInput!): Surveys
deleteSurveys(input: DeleteSurveysInput!): Surveys
createWaterQuality(input: CreateWaterQualityInput!): WaterQuality
updateWaterQuality(input: UpdateWaterQualityInput!): WaterQuality
deleteWaterQuality(input: DeleteWaterQualityInput!): WaterQuality
}
type Query {
getSurveys(year: Int!, uuid: String!): Surveys
listSurveys(filter: TableSurveysFilterInput, limit: Int, nextToken: String): SurveysConnection
getWaterQuality(uuid: String!): WaterQuality
listWaterQualities(filter: TableWaterQualityFilterInput, limit: Int, nextToken: String): WaterQualityConnection
}
type Subscription {
onCreateSurveys(
uuid: String,
year: Int,
geocode: AWSJSON,
metadata: AWSJSON,
observations: AWSJSON
): Surveys
@aws_subscribe(mutations: ["createSurveys"])
onUpdateSurveys(
uuid: String,
year: Int,
geocode: AWSJSON,
metadata: AWSJSON,
observations: AWSJSON
): Surveys
@aws_subscribe(mutations: ["updateSurveys"])
onDeleteSurveys(
uuid: String,
year: Int,
geocode: AWSJSON,
metadata: AWSJSON,
observations: AWSJSON
): Surveys
@aws_subscribe(mutations: ["deleteSurveys"])
onCreateWaterQuality(uuid: String): WaterQuality
@aws_subscribe(mutations: ["createWaterQuality"])
onUpdateWaterQuality(uuid: String): WaterQuality
@aws_subscribe(mutations: ["updateWaterQuality"])
onDeleteWaterQuality(uuid: String): WaterQuality
@aws_subscribe(mutations: ["deleteWaterQuality"])
}
type Surveys {
uuid: String!
year: Int!
geocode: AWSJSON!
metadata: AWSJSON!
observations: AWSJSON!
report_url: String
survey_date: String!
video_url: String!
}
type SurveysConnection {
items: [Surveys]
nextToken: String
}
input TableBooleanFilterInput {
ne: Boolean
eq: Boolean
}
input TableFloatFilterInput {
ne: Float
eq: Float
le: Float
lt: Float
ge: Float
gt: Float
contains: Float
notContains: Float
between: [Float]
}
input TableIDFilterInput {
ne: ID
eq: ID
le: ID
lt: ID
ge: ID
gt: ID
contains: ID
notContains: ID
between: [ID]
beginsWith: ID
}
input TableIntFilterInput {
ne: Int
eq: Int
le: Int
lt: Int
ge: Int
gt: Int
contains: Int
notContains: Int
between: [Int]
}
input TableStringFilterInput {
ne: String
eq: String
le: String
lt: String
ge: String
gt: String
contains: String
notContains: String
between: [String]
beginsWith: String
}
input TableSurveysFilterInput {
uuid: TableStringFilterInput
year: TableIntFilterInput
report_url: TableStringFilterInput
survey_date: TableStringFilterInput
video_url: TableStringFilterInput
}
input TableWaterQualityFilterInput {
uuid: TableStringFilterInput
}
input UpdateSurveysInput {
uuid: String!
year: Int!
geocode: AWSJSON
metadata: AWSJSON
observations: AWSJSON
report_url: String
survey_date: String
video_url: String
}
input UpdateWaterQualityInput {
uuid: String!
}
type WaterQuality {
uuid: String!
flow: AWSJSON!
free_chlorine: AWSJSON!
location: String!
ph: AWSJSON!
pressure: AWSJSON!
temperature: AWSJSON!
timestamp: Int!
}
type WaterQualityConnection {
items: [WaterQuality]
nextToken: String
}
...以及附加到列表查询listWaterQualities的以下解析器:
{
"version": "2017-02-28",
"operation": "Scan",
"filter": #if($context.args.filter) $util.transform.toDynamoDBFilterExpression($ctx.args.filter) #else null #end,
"limit": $util.defaultIfNull($ctx.args.limit, 20),
"nextToken": $util.toJson($util.defaultIfNullOrEmpty($ctx.args.nextToken, null)),
}
$util.toJson($context.result.items)
...以及以下数据库表结构(主键 uuid):
{
"flow": {
"raw": 7.1148501551630785,
"value": 113.83760248260926
},
"free_chlorine": {
"raw": 0.35,
"value": 0.35
},
"location": "mars",
"ph": {
"raw": 0.2,
"value": -6.15152
},
"pressure": {
"raw": 13248.528910641011,
"value": 86.19716484615098
},
"temperature": {
"raw": 684.7506156784981,
"value": 16.883287645632485
},
"timestamp": 1602381709752,
"uuid": "008b5a2ad27b42b8a311f021510fca87"
}
...并在 AppSync 控制台中和通过代码运行查询。我正在超时。
content-length: 1033
content-type: text/html
date: Sun, 11 Oct 2020 15:09:06 GMT
server: CloudFront
status: 504
via: 1.1 xxxxxxx.cloudfront.net (CloudFront)
x-amz-cf-id: xxxxxxx_2whgDivdLvdgGMRHz7O6g1d-5CSiBX0xVLXhIvfhQA==
x-amz-cf-pop: DFW3-C1
x-cache: Error from cloudfront
抱歉,如果这已经解决但我找不到相关的解决方案,任何人都可以发现我的错误/问题。我忽略了什么,或者明显是错误的原因?
一如既往地感谢任何和所有的反馈,并提前感谢!
解决方案
好吧,如果其他人开始看到这些错误,不要在这里寻找积分,因为这是我的错误 buuuut:
我的问题最终是我在 api 数据源中选择的用户角色:
Create or use an existing role
Allow AWS AppSync to securely interact with your data source.
我选择使用现有并选择与不同 ddb 表关联的 IAM 用户,因此从未与正确的表建立连接,因此没有数据/超时......
抱歉占用了这里的空间...
推荐阅读
- javascript - 显示更多/显示更少文本
- reactjs - 在 render() 中更新状态时防止无限循环
- python - TensorFlow Square 函数识别
- ansible - 跳过传递给任务 ansible 的循环的多个值
- jquery - 在函数调用它之后执行 ngFor?
- c# - C#:在没有 [await] 的情况下调用 [async] 方法不会捕获其抛出的异常?
- android - 如何使用 CameraX 从相机获取位图流?
- android - Android 间隙文字
- javascript - 是否可以在一个共同的地方设置样式和 JavaScript 引用并将其用于所有 HTML 页面?
- python - 实际上无法找到 from_db_value 在 django 源代码中的工作原理?