

# Troubleshooting
<a name="troubleshooting"></a>

If you need help with this solution, Contact AWS Support to open a support case for this solution.

# Contact AWS Support
<a name="contact-aws-support"></a>

If you have [AWS Business Support\$1](https://aws.amazon.com/premiumsupport/plans/business-plus/), [AWS Enterprise Support](https://aws.amazon.com/premiumsupport/plans/enterprise/), or [Unified Operations](https://aws.amazon.com/premiumsupport/plans/unified-operations/), you can use the AWS Support Center to get expert assistance with this solution. The following sections provide instructions.

## Create case
<a name="create-case"></a>

1. Sign in to [Support Center](https://support.console.aws.amazon.com/support/home#/).

1. Choose **Create case**.

## How can we help?
<a name="how-can-we-help"></a>

1. Choose **Technical**.

1. For **Service**, select **Solutions**.

1. For **Category**, select **Other Solutions**.

1. For **Severity**, select the option that best matches your use case.

1. When you enter the **Service**, **Category**, and **Severity**, the interface populates links to common troubleshooting questions. If you can’t resolve your question with these links, choose **Next step: Additional information**.

## Additional information
<a name="additional-information"></a>

1. For **Subject**, enter text summarizing your question or issue.

1. For **Description**, describe the issue in detail, including the name of this solution and the version you are using, such as this example: **Dynamic Image Transformation for Amazon CloudFront vX.Y.Z**.

1. Choose **Attach files**.

1. Attach the information that AWS Support needs to process the request.

## Help us resolve your case faster
<a name="help-us-resolve-your-case-faster"></a>

1. Enter the requested information.

1. Choose **Next step: Solve now or contact us**.

## Solve now or contact us
<a name="solve-now-or-contact-us"></a>

1. Review the **Solve now** solutions.

1. If you can’t resolve your issue with these solutions, choose **Contact us**, enter the requested information, and choose **Submit**.

# Transformation policy errors
<a name="transformation-policy-errors"></a>

# Policy validation failures
<a name="policy-validation-failures"></a>

 **Symptoms:** - 400 Bad Request errors when creating policies - Policy creation fails in Admin UI - "Invalid policy JSON" error messages

 **Solutions:** 

 **Check JSON syntax:** 
+ Validate JSON structure using online JSON validators
+ Ensure all required fields are present
+ Verify transformation parameter types match schema requirements

 **Review transformation limits:** - Policy size limit: 400KB - Ensure transformation values are within valid ranges

# Policy not being applied
<a name="policy-not-being-applied"></a>

 **Symptoms:** - Images not transformed according to policy - Default transformations applied instead of policy - Policy appears in Admin UI but doesn’t affect images

 **Solutions:** 

 **Verify policy mapping:** 
+ Check if policy is correctly associated with origin mapping
+ Ensure policy ID is specified correctly in requests
+ Verify default policy is set if no policy ID provided

 **Refresh configuration cache:** 
+ Use Admin UI "Refresh Cache" button after policy changes
+ Wait 5 minutes for rolling update to complete
+ Check ECS task logs for cache refresh confirmation

# Conditional transformation issues
<a name="conditional-transformation-issues"></a>

 **Symptoms:** - Conditional transformations not triggering - Wrong transformation applied based on conditions - Client hints not being evaluated correctly

 **Solutions:** 

 **Review condition syntax:** 
+ Verify field names match available headers
+ Check condition values and operators
+ Ensure client is sending required headers

 **Test condition logic:** 
+ Use Admin UI testing tools to validate conditions
+ Check request headers in browser developer tools
+ Verify condition evaluation in ECS task logs

# Seeing cached images even after making configuration changes on Admin UI
<a name="seeing-cached-images"></a>

 **Problem:** Images continue to show previous transformations even after updating origins, policies, or mappings through the Admin UI.

 **Cause:** CloudFront caches processed images based on the request URL and headers. Configuration changes don’t automatically invalidate existing cached images.

 **Solution:** Create a CloudFront invalidation to clear cached images:

1. Navigate to the CloudFront console

1. Select the distribution created by the solution

1. Go to the **Invalidations** tab

1. Click **Create invalidation** 

1. Enter the path pattern for images to invalidate:
   + For all images: `/*` 
   + For specific paths: `/images/ ` or `/mobile/` 

1. Click **Create invalidation** 

The invalidation will clear cached images, forcing CloudFront to request fresh images with the new configuration applied.

# Enable debug logs
<a name="enable-debug-logs"></a>

 **Problem:** Need detailed logging information for troubleshooting image processing issues.

 **Solution:** Debug logs are not enabled by default. To enable debug logging:

1. Navigate to the AWS Lambda console

1. Find the image processing Lambda function created by the solution

1. Go to the **Configuration** tab

1. Select **Environment variables** 

1. Add or modify the debug logging environment variables (exact variable names can be found in the CDK construct)

1. Save the changes

Debug logs will provide detailed information about image processing operations, transformation steps, and error details to help with troubleshooting.

# Tracing API errors using request ID
<a name="tracing-api-errors"></a>

 **Problem:** Need to identify the root cause of API errors or failed image processing requests.

 **Solution:** Each API response includes an `x-amz-request-id` header that can be used to trace the request in CloudWatch logs:

1. Capture the `x-amz-request-id` from the API response headers

1. Navigate to the CloudWatch console

1. Go to **Log groups** 

1. Find the log group for the image processing service:
   + Lambda architecture: Look for the Lambda function log group
   + ECS architecture: Look for the ECS task log group

1. Search for the request ID in the logs:
   + Use the CloudWatch Logs Insights query: `fields @timestamp, @message | filter @message like /REQUEST_ID/` 
   + Replace `REQUEST_ID` with the actual request ID value

1. Review the log entries to identify error messages, stack traces, or processing details

The request ID allows you to trace the complete request lifecycle and identify exactly where errors occurred during image processing.