Closed webchaz closed 5 years ago
Just a follow up to this, when this enabled, should the stage settings in API Gateway have Cache enabled?
Seeing the same issue with the exact same setup
@djakaitis Looks like the cache-hit from CloudFront is not an indication of cache working or not. I had stepped away from this, but not sure if there's a way to verify.
@webchaz I just verified it is working correctly by checking cloudwatch lambda logs. No lambda is being invoked as a result of the api cache. When I flushed the cache the next invocation hit lambda.
@djakaitis That's a great idea, i guess just absence of a log is that it hit cache. Thanks, will check that out.
@webchaz API Gateway has its own cache instance under the hood, it's not the same as CloudFront (more details). You wouldn't see a cache hit from CloudFront after you enable this plugin.
One other way to check that your request is coming from the cache, aside from checking lambda logs, is to add a response header with the ISO timestamp and check that it stays the same across requests.
@DianaIonita Thanks for this, tried this out, but it's not working. Should API Cache be enabled within API Gateway? With this enabled, it caches everything, without regard to the settings, with it disabled, just no dice.
Should this be showing a hit from cloudfront if configured correctly?
This is what I have and doesn't seem to be caching:
For functions:
Thank you!