【问题标题】:AppSync with CDK Deploy Failed with : `There is no scalar implementation for the named 'AWSTimeStamp' scalar type.`使用 CDK 部署的 AppSync 失败,原因是:`命名的“AWSTimeStamp”标量类型没有标量实现。`
【发布时间】:2021-05-04 10:26:40
【问题描述】:

语言:打字稿

工具:Appsync 和 CDK

总结:我正在尝试在我的 Graphql 架构中使用标量 AWSTimeStamp

错误信息

UPDATE_FAILED | AWS::AppSync::GraphQLSchema Schema Creation Status is FAILED with details: Found 1 problem(s) with the schema: There is no scalar implementation for the named 'AWSTimeStamp' scalar type.

架构文件

index.graphql

schema {
  query: Query
  mutation: Mutation
}

type Query
type Mutation

scalar AWSTimeStamp

type Address {
  id: ID
  addressNickName: String
  address1: String
  address2: String
  attnTo: String
  city: String
  state: String
  zipCode: String
  country: String
  createdAt: AWSTimeStamp
  updatedAt: AWSTimeStamp
  isActive: Boolean
}

dealership.graphql

extend type Mutation {
  createDealership(input: CreateDealershipInput): DealershipPayload
}

input CreateDealershipInput {
  engineId: ID!
  name: String
  slug: String
  address: AddressInput
}

type DealershipPayload {
  id: ID
  engineId: ID
  name: String
  slug: String
  salesAddressId: ID
  salesAddress: Address
}

input AddressInput {
  addressNickName: String
  address1: String
  address2: String
  attnTo: String
  city: String
  state: String
  zipCode: String
  country: String
}

注意:这两个 graphql 文件会自动合并到 schema.graphql

schema.graphql

schema { 
  query: Query 
  mutation: Mutation   
}

type Address {
  id: ID
  addressNickName: String
  address1: String
  address2: String
  attnTo: String
  city: String
  state: String
  zipCode: String
  country: String
  createdAt: AWSTimeStamp
  updatedAt: AWSTimeStamp
  isActive: Boolean
}

input AddressInput {
  addressNickName: String
  address1: String
  address2: String
  attnTo: String
  city: String
  state: String
  zipCode: String
  country: String
}

scalar AWSTimeStamp

input CreateDealershipInput {
  engineId: ID!
  name: String
  slug: String
  address: AddressInput
}

type DealershipPayload {
  id: ID
  engineId: ID
  name: String
  slug: String
  salesAddressId: ID
  salesAddress: Address
}

type Mutation {
  createDealership(input: CreateDealershipInput): DealershipPayload
}

当我删除“标量 AWSTimeStamp”并将 AWSTimeStamp 类型替换为“字符串”时,部署成功。我不确定是否需要导入某些内容才能使用 AWSTimeStamp 标量。我正在查看此文档https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-appsync.GraphqlType.html,但如果这实际上是我需要的,我不确定在哪里插入此导入。我对 GraphQL 和 CDK 很陌生。我期待一些指导!谢谢。

【问题讨论】:

    标签: amazon-web-services graphql aws-appsync aws-cdk scalar


    【解决方案1】:

    您有 AWSTimeStamp 和大写的 S,但 AppSync 标量类型是 AWSTimestamp 和小写的 s

    【讨论】:

    • 詹姆逊,谢谢你的工作。我很尴尬,但很感激一切正常。
    猜你喜欢
    • 2022-07-30
    • 1970-01-01
    • 2019-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-09
    • 2011-08-23
    • 2023-01-30
    相关资源
    最近更新 更多