Cloud Techies
Published in

Cloud Techies

Troubleshooting Lambda@Edge function


  1. You can configure test Events, for example — Viewer-Request and Origin-Response that allows you to do unit testing in AWS console.

2. You can dump the entire Event to CloudWatch log by adding the following line in your function→ convert event to json string with 4 space indentation.

console.log(‘Received event:’, JSON.stringify(event, null, 4));

3. For end to end testing, ensure you rename the target file in S3 that your browser points to. This ensures no issues with caching on browser or lambda@edge side that could cause the lambda function not being invoked.

4. The console.log output of the lambda function that is sent to cloudwatch log can be found using the following.

CloudFront → Monitoring → Lambda@Edge functions

5. Check the invocation to determine which region on the lambda@edge got invoked and from the View function logs drop down list select that region.

There you go, you got the logs now !



A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arun Kumar

Cloud Architect | AWS, GCP, Azure, Python, Kubernetes, Terraform, Ansible