Comments (9)
#65 Solved this!
from serverless-api-gateway-caching.
I changed the endpoint to a GET
request with query string parameters and its working. Just out of interest, is there a way to get this to work for a POST
request?
I've only ever seen examples using GET
but according to the AWS docs it can be done.
from serverless-api-gateway-caching.
Hi @Jordan-Eckowitz,
You can define caching on a POST
method, however the issue seems to be with cache key parameters.
According to AWS Documentation on request data mapping expressions, it should be possible to use method.request.body
or method.request.body.JSONPath_Expression
(this plugin simplifies the declaration and omits the method
prefix).
However, AWS seems to reject CloudFormation templates which use those mappings.
I also can't find a way in the API Gateway console to click through and add body
or a property on the body as a cache key parameter. Maybe I'm missing something though, so please let me know if it's possible through the UI.
In the meantime, I should update the documentation of the plugin and remove request.body
and request.body.JSONPath_EXPRESSION
as possible cache key parameters.
from serverless-api-gateway-caching.
Hi @DianaIonita,
Thanks for the response and creating this plugin - its saved me a lot of time!
There's a section here called Override API Gateway Stage-Level Caching for Method Caching with details on how to setup custom method caching if an endpoint isn't a GET
method. It looks like this would need to be enabled for request body mapping to work.
These are the steps they outline in the docs:
To configure API caching for individual methods using the console:
Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway.
Go to the API Gateway console.
Choose the API.
Choose Stages.
In the Stages list for the API, expand the stage and choose a method in the API.
Choose Override for this method in Settings.
In the Cache Settings area, you can set or clear Enable Method Cache or customize any other desired options. (This section is shown only if stage-level caching is enabled.)
from serverless-api-gateway-caching.
Hi Jordan,
I was looking at that page and I can see options for adding cache key parameters from the query string, header, but nothing about the body:
from serverless-api-gateway-caching.
You've got to go to the endpoint under the Stages
section of the API.
from serverless-api-gateway-caching.
Yes, that's already enabled. The issue is with configuring the cache key parameters under Resources
.
from serverless-api-gateway-caching.
Feel free to reopen this if you have any more information about the issue.
from serverless-api-gateway-caching.
any news on this ? need caching for post body (entire or some specific keys)
from serverless-api-gateway-caching.
Related Issues (20)
- client certificate as cacheKeyParameters HOT 7
- Upgrade from 1.7.5 to 1.8.0 breaking API Gateway endpoint HOT 6
- Internal Server Error when setting cache key parameter request.header.Authorization HOT 2
- support for httpApi HOT 1
- Support API Gateway V2 HOT 1
- Support on cache by body on POST request HOT 6
- Serverless Offline error HOT 4
- Caching stops working as soon as I set cacheKeyParameters HOT 1
- Is there a way to invalidate all caches for a specific key? HOT 2
- Invalid logging level specified: null on v1.10.0 HOT 3
- Is it possible to ignore non 200 responses? HOT 1
- Getting a bunch of APIs with "Inherit from stage" unexpectedly HOT 4
- TTL configs not applied by Api Gateway HOT 1
- /proxy - cache miss on every request - NestJs HOT 1
- Support Chinese characters in cacheKeyParameters HOT 4
- New serverless release not compliant with pulgin HOT 2
- cacheKeyParameters are always required as of 1.10.3
- Unable to set cache key from the request context HOT 1
- API gateway cacheKeyParameters error HOT 2
- headers caching for multi-tenant HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-api-gateway-caching.