question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(@aws-cdk/aws-appsync): Internal error while saving the schema

See original GitHub issue

When 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:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MrArnoldPalmercommented, Apr 2, 2021

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.

0reactions
github-actions[bot]commented, Apr 2, 2021

⚠️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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found