1

Cheers,

I have a deployed Amazon API Gateway that is working perfectly when the API Gateway Cache is not turned on, but returns only empty results when I turn the cache on.

Design: API Gateway => Lambda function (custom authorization) => Lambda function (retrieving actual data)

Without cache I get CloudWatch log entries for both the authorization function and the actual data function, but with cache it seems only the authorization function is called (authorization looks ok) and the actual data is never retrieved.

The results returned to the client look completely similar (200 OK) with the only difference being no data is returned when cache is enabled.

Any ideas how to debug this or what might be the problem? :)

mglonnro
  • 151
  • 10
  • I can't diagnose the specific problem in your case without additional information. If you want to post or PM me your region and API URL then I can look at the configuration. – MikeD at AWS Jun 30 '16 at 01:02
  • One common problem with caching is enabling caching for a stage which enables caching for all resources/methods by default. Most customers only want to cache GET responses and need to disable caching on other methods. – MikeD at AWS Jun 30 '16 at 01:02

1 Answers1

1

We have exactly the same issue with AWS API Gateway. Enabling cache on some GET methods using the x-amazon-apigateway-integration and enabling the cache at Stage level. The responses for GET methods cached returns 200 and empty payload. We use custom authorizer with lambda function, so normally we should test if the query is authorized to access to our API. I even try to put cache-control: max-age=0 to force the refresh of cache without success.

For me the AWS APIG Cache doesn't work at all!

I found some comments on the WEB which advices to disable it and use the CloudFront one. So I am little bit lost, the Cache is a feature of the API Gateway but can't use it?

user3774109
  • 1,978
  • 1
  • 12
  • 13
  • Have you guys check https://stackoverflow.com/questions/55968925/api-gateway-returning-403-forbidden/55969318#55969318 – user8142520 Dec 04 '19 at 01:29