(@aws-cdk/aws-appsync): Internal error while saving the schema
See original GitHub issueWhen creating a GraphQL API, cloudformation keeps failing with an “Internal error while saving the schema” error.
Reproduction Steps
Typescript
const websiteGraphqlApi = new GraphqlApi(this, 'api', {
name: `My API`,
logConfig: {
fieldLogLevel: FieldLogLevel.ALL,
},
authorizationConfig: {
defaultAuthorization: {
authorizationType: AuthorizationType.USER_POOL,
userPoolConfig: {
userPool: props.userPool,
defaultAction: UserPoolDefaultAction.ALLOW
},
},
additionalAuthorizationModes: [{
authorizationType: AuthorizationType.API_KEY,
}],
},
schema: Schema.fromAsset(join(__dirname, 'schema.graphql'))
});
const productsTable = new Table(this, 'products-table', {
partitionKey: {
name: 'id',
type: AttributeType.STRING,
},
});
const productsDataSource = websiteGraphqlApi.addDynamoDbDataSource('products-datasource', productsTable);
productsDataSource.createResolver({
typeName: 'Query',
fieldName: 'getProducts',
requestMappingTemplate: MappingTemplate.dynamoDbScanTable(),
responseMappingTemplate: MappingTemplate.dynamoDbResultList(),
});
productsDataSource.createResolver({
typeName: 'Mutation',
fieldName: 'addProduct',
requestMappingTemplate: MappingTemplate.dynamoDbPutItem(
PrimaryKey.partition('id').auto(),
Values.projecting('Product')
),
responseMappingTemplate: MappingTemplate.dynamoDbResultItem(),
});
schema.graphql
type Product {
id: ID!
title: String!
price: Int!
quantity: Int!
category: Category!
}
type Category {
id: ID!
title: String!
Products: [Product!]!
}
type Query {
getProducts: [Product!]!
}
input CategoryInput {
id: String!
}
input AddProductInput {
title: String!
price: Int!
quantity: Int!
category: CategoryInput!
}
type Mutation {
addProduct(input: AddProductInput!): Product
}
What did you expect to happen?
Appsync to be created with the schema.
What actually happened?
CloudFormation fails with the error:
Schema Creation Status is FAILED with details: Internal Failure while saving the schema.
Environment
- CDK CLI Version : 1.88.0 (build f65009b)
- Framework Version:
- Node.js Version: node12.18
- OS: Linux
- Language (Version): TypeScript (3.8.3)
Other
I’ve tried using the example on the AWS-CDK documentation here for both the schema and typescript however I still get the same issue.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
aws cdk appsync Schema Creation Status is FAILED with details
I get the following error message during the AWS::AppSync::GraphQLSchema deployment phase: GraphQLApi/Schema (GraphQLApiSchema5937B126) Schema ...
Read more >Troubleshooting and Common Mistakes - AWS AppSync
This section discusses some common errors and how to troubleshoot them. Incorrect DynamoDB Key Mapping. If your GraphQL operation returns the following ...
Read more >aws-cdk/aws-appsync module - AWS Documentation
When declaring your GraphQL Api, CDK defaults to a code-first approach if the schema property is not configured. const api = new appsync.GraphqlApi(this,...
Read more >Designing your schema - AWS AppSync
Sign in to the AWS Management Console and open the AppSync console . In the APIs dashboard, choose your GraphQL API. In the...
Read more >Monitoring and logging - AWS AppSync
To monitor your AWS AppSync GraphQL API and help debug issues related to requests, you can turn on logging to Amazon CloudWatch Logs....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks @owenashurst for the update. Closing this for now. It seems AppSync can throw quite a few “internal errors” during deploy related to the schema. It would be nice if we could start to catch these earlier and trow better messages. Closing for now but @PeterEckIII open another issue with your repro if you haven’t solved it and we will take another look.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.