如何解决AppSync with CDK Deploy Failed with :`命名的'AWSTimeStamp'标量类型没有标量实现`
语言:打字稿
工具: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 类型替换为“String”时,部署成功。我不确定是否需要导入某些内容才能使用 AWSTimeStamp 标量。我正在查看此文档 https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-appsync.GraphqlType.html,但如果这实际上是我需要的,我不确定在哪里插入此导入。我对 GraphQL 和 CDK 很陌生。我期待着一些指导!谢谢。
解决方法
您有带有大写 AWSTimeStamp
的 S
,但 AppSync 标量类型是带有小写 s
的 AWSTimestamp
。 >
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。