Language: TypeScript
Tools: Appsync and CDK
Summary: I am trying to use scalar AWSTimeStamp in my Graphql Schema
Error message:
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.
Schema files:
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
}
Note: These two graphql files get auto merged into a 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
}
When I remove 'scalar AWSTimeStamp' and replace the AWSTimeStamp type with 'String' the deploy is successful. I am not certain if I need to import something to use the AWSTimeStamp scalar. I am looking at this document https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-appsync.GraphqlType.html but I am not certain where to insert this import if this is in-fact what I need. I am very new to GraphQL and CDK. I look forward to some guidance! Thank you.
You have AWSTimeStamp
with an upper-case S
, but the AppSync scalar type is AWSTimestamp
with a lowercase s
.