Hello,
I understand that you have created AppSync API using CDK, which is returning null response for listMyTables query.
Here is a blogpost example on creating AppSync API, using CDK:
https://aws.amazon.com/blogs/mobile/building-scalable-graphql-apis-on-aws-with-cdk-and-aws-appsync/
In order to troubleshoot this issue, we require details that are specific to AppSync API deployment in your account. We need to evaluate schema definition, resolver, data source, permissions and AppSync logs for your API. Please open a support case with AWS, including these details, using this link
Thank you Isha. I opened a support case and received a helpful answer. I ended up having to provide more detail in my resolver. I copied the code that was generated in the "console" created api, and pasted it in like below. With this change, the API functioned as expected:
change from this:
datasource.createResolver({
typeName: 'Query',
fieldName: 'listCctSharedCallRoutingGlobalDbs',
requestMappingTemplate: MappingTemplate.dynamoDbScanTable(),
responseMappingTemplate: MappingTemplate.dynamoDbResultList(),
});
to this:
datasource.createResolver({
typeName: 'Query',
fieldName: 'listCctSharedCallRoutingGlobalDbs',
requestMappingTemplate: MappingTemplate.fromString(`
#set( $ListRequest = {
"version": "2018-05-29"
} )
#if( $context.args.nextToken )
#set( $ListRequest.nextToken = $context.args.nextToken )
#end
#if( $context.args.limit )
#set( $ListRequest.limit = $context.args.limit )
#end
$util.qr($ListRequest.put("operation", "Scan"))
$util.toJson($ListRequest)
`),
responseMappingTemplate: MappingTemplate.fromString(`
#if( $ctx.error)
$util.error($ctx.error.message, $ctx.error.type)
#else
$util.toJson($ctx.result)
#end
`),
});
Relevant questions
Can't access created keyspace/table via Java API
asked 2 years agoUsing Cloud Trail Console to view all events in multi-account CloudTrail ( created via Organizations )
Accepted Answerasked 4 months agoSimple Join query errors out with "table not found"
asked 3 months agoHow can I find the Query ID for an Athena Saved Query on AWS console?
asked 7 months agoAppsync composite key (GSI in dynamodb) returns Null in query response
asked 4 months agoGlue table not showing in console
asked 4 months agoCDK destroy is not deleting DynamoDB table created by CDK
Accepted Answerasked 7 months agoHow do I set up an AWS Amplify project to query an existing AWS AppSync API?
asked 4 months agoCan we add column to an existing table in AWS Athena using SQL query?
Accepted Answerasked 3 years agoAppsync created with CDK, Query not showing results
asked 2 months ago