SAP-C02 Continuous Improvement for Existing Solutions Practice Question
A company uses Amazon API Gateway with a Lambda authorizer to control access to its APIs. Recently, some requests are returning 401 Unauthorized errors even though the tokens are valid. The Lambda authorizer logs show that the function is invoked and returns an IAM policy. What is the MOST likely cause?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The authorizer result is cached, and a previous invalid token caused a deny policy to be cached.
API Gateway caches the authorizer result based on the token. If a previous request with the same token was denied (e.g., due to an invalid token at that time), the cached deny policy will be used for subsequent requests even if the token is now valid, causing a 401 error. Option A is incorrect because the Lambda authorizer is being invoked successfully and returning a policy; the issue is with caching. Option B is incorrect because the problem states tokens are valid, not expired. Option C is incorrect because throttling would result in the authorizer not being invoked, but the logs show it is invoked.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The Lambda function is returning a malformed IAM policy.
Why it's wrong here
Malformed policies cause 500 errors, not 401.
- ✗
The token has expired.
Why it's wrong here
Token expiration would be a different error, but the authorizer is invoked.
- ✗
The Lambda authorizer is not being invoked due to throttling.
Why it's wrong here
Logs show invocation, so throttling is not the issue.
- ✓
The authorizer result is cached, and a previous invalid token caused a deny policy to be cached.
Why this is correct
Cached deny responses cause subsequent valid tokens to be rejected.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
This SAP-C02 question is part of Courseiva's 1,660-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.