Closed kkirov closed 3 years ago
What's the order of your plugins? Order matters.
but I also tried:
and I get the same result.
I'm getting this same issue using serverless-plugin-split-stacks
have also tried multiple order for including these. Any chance you found a solution to this?
For now, the only solution that I've found is to set restApiId
and restApiRootResourceId
manually:
provider:
apiGateway:
restApiId: xxxxx
restApiRootResourceId: xxxxx
How to get them: https://serverless.com/framework/docs/providers/aws/events/apigateway#manually-configuring-shared-api-gateway
Can be also set separately for stages using custom
section and variables.
I am also facing same issue when used with serverless-plugin-split-stacks
.
Same issue using serverless-plugin-split-stacks
. Any solution rather than setting the restApiId manually?
Actually I found this package that I believe is a fork of this one and it's working: https://www.npmjs.com/package/serverless-api-gateway-caching-split-stack
All I have to do (after spent some time looking at the code) is add this configuration:
apiGatewayCaching:
forceEnable: true
And changing the plugin to:
- serverless-api-gateway-caching-split-stack
Maybe someone can merge this in this repo?
If you are using split stack you need it to place the AWS :: ApiGateway :: RestApi resource in the root. To cause that you need to use the file stacks-map.js.
if (resource.Type.includes('AWS::ApiGateway::RestApi')) {
return false;
}
Be careful, returning null or undefined is not enough.
The serverless-nested-stack breaks down the stacks in few nested stacks to avoid the cloudformation limitation of 200 resources per stack. And when I use serverless-nested-stack breaks and serverless-api-gateway-caching I get:
Serverless: [serverless-api-gateway-caching] No Rest API found. Caching settings will not be updated.
It seems to me that the code: https://github.com/DianaIonita/serverless-api-gateway-caching/blob/develop/src/restApiId.js#L15 is not checking in all nested stacks if resource 'ApiGatewayRestApi' exists! Let me know if you need me to provide any additional information!