AppSync with CDK Deploy Failed with :`没有用于命名 'AWSTimeStamp' 标量类型的标量实现。`

AppSync with CDK Deploy Failed with : `There is no scalar implementation for the named 'AWSTimeStamp' scalar type.`

语言:TypeScript

工具: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
}

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

您有 AWSTimeStamp,大写 S,但 AppSync 标量类型是 AWSTimestamp,小写 [=13] =].