当前位置: 首页 > 知识库问答 >
问题:

AWS AppSync列表查询在控制台和代码中出现504错误

乔丁雨
2023-03-14

给定以下模式:

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)

...和以下db表结构(主键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

道歉如果这已经解决了,但我找不到相关的解决方案,有人能发现我的错误/问题吗。我忽略了什么,或者是明显的错误原因?

一如既往地感谢任何和所有的反馈和提前感谢!

共有1个答案

伊飞光
2023-03-14

好吧,不要在这里寻找点,因为这是我的错误,但是,如果其他人开始看到这些错误:

我的问题是我在api数据源中选择的用户角色:

Create or use an existing role
Allow AWS AppSync to securely interact with your data source.

我选择了use existing并选择了与不同ddb表关联的IAM用户,因此从未连接到正确的表,因此没有数据/超时。。。

抱歉占用了这里的空间...

 类似资料:
  • 沙拉酱:Sms.last Salammobile::Sms加载(106.1毫秒)选择< code>sms。*从< code>sms订购到< code>sms。< code>oppid DESC限制1 active record::subclass not found:单表继承机制无法定位子类:“international”。引发此错误是因为列“type”是为在继承的情况下存储类而保留的。如果不想将

  • 问题内容: 我对使用Java代码的SPARQL端点有问题。 特别是,我有这个Java类: 我想检索谓词为“ RDF:type” 的资源“ http://dbpedia.org/resource/Fred_Guy ” 的对象。但是我有一个我不明白的错误: 为什么会出现此错误? 我正在尝试执行此查询 “ http://dbpedia.org/sparql ” 没有写strstarts,我得到这个错误:

  • 所以我有一个家庭作业,要求我做以下事情: < li >该公司最近改变了其年度总薪酬政策,以提高销售额 < li >销售人员将继续获得55,000.00美元的固定工资。每个销售人员的当前销售目标是100,000.00美元。 < li >只有完成80%的销售目标,销售激励才会开始。目前的佣金是总销售额的14%。 < li >如果销售人员超额完成销售目标,佣金将根据加速系数增加。加速系数为1.40。 <

  • 控制台-部门-列表 接口URL {youke-url}/console/Index.php?c=department&a=list&timestamp=1607677497&access_key=abc&sign=c7da8103312da8793af4f526a42cb6ebaa06cfd4 请求方式 POST Content-Type form-data 请求Query参数 参数 示例值 是否

  • 控制台-频道-列表 接口URL {youke-url}/console/Index.php?c=live&a=list&timestamp=1607677497&access_key=abc&sign=1d1f1f11b2fa0a7352b5603871322035efb81f0a 请求方式 POST Content-Type form-data 请求Body参数 参数 示例值 是否必填 参数描述

  • 问题内容: Lucene的新手在这里。我在Java客户端中将它与Hibernate一起使用,并且在特定查询中遇到此错误: 搜索适用于所有其他查询,即使结果集为空。我的测试数据库确实具有“ a”的记录。这有什么问题吗? 问题答案: “ a”是停用词,StandardAnalyzer会将其从查询中过滤掉。停用词是在您使用的搜索语言中足够普遍的词,并且对生成搜索结果没有意义。这是一个简短的列表,但是“