AppSync Logging Disabled
appsync-logging-disabled
What this rule checks
Detects AppSync APIs without logging, field-level logging, or X-Ray tracing.
How to fix it
- 1Configure LogConfig to capture request/response logs in CloudWatch
- 2Set FieldLogLevel to ERROR or ALL for resolver execution detail
- 3Enable XrayEnabled for distributed tracing
import * as appsync from 'aws-cdk-lib/aws-appsync';
new appsync.CfnGraphQLApi(this, 'Api', {
name: 'my-api',
authenticationType: 'AWS_IAM',
});import * as appsync from 'aws-cdk-lib/aws-appsync';
new appsync.CfnGraphQLApi(this, 'Api', {
name: 'my-api',
authenticationType: 'AWS_IAM',
xrayEnabled: true,
logConfig: {
cloudWatchLogsRoleArn: 'arn:aws:iam::111122223333:role/AppSyncLogs',
fieldLogLevel: 'ERROR',
},
});CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.
Affected resource types
AWS::AppSync::GraphQLApiIntentional? Suppress this finding
Sometimes a flag is deliberate β a genuinely public endpoint, say. You can dismiss appsync-logging-disabled and the reason is kept in the report, not silently hidden.
In .cdk-insights.json:
{
"ignoreRules": [
{ "id": "appsync-logging-disabled", "reason": "Why this is intentional" }
]
}Or inline in your CDK code:
Validations.of(scope).acknowledge({
id: 'cdk-insights::appsync-logging-disabled',
reason: 'Why this is intentional',
});Use the rule ID appsync-logging-disabled shown above β not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs β
Catch this in your stack
$ npx cdk-insights scanCDK Insights runs this and 118+ other rules locally against your synthesised CDK app β free, no account, your code never leaves your machine.