Invalid cache key parameter specified when enabling caching for a path parameter in AWS API Gateway
I have a serverless web API (API Gateway + Lambda) that I have built in C# and deployed via Visual Studio. This is achieved via a serverless.yml file that auto-creates a CloudFormation template, then that template is applied to create the API stack.
Once my stack is deployed, I have gone into the AWS Console to enable caching on one of the path parameters, but get this error:
!https://ibb.co/B4wmRRj
I'm aware of this post https://forums.aws.amazon.com/thread.jspa?messageID=711315򭪓 which details a similar but different issue where the user can't uncheck caching. My issue is I can't enable it to begin with. I also don't understand the steps provided to resolve the issue within that post. There is mention of using the AWS CLI, but not what commands to use, or what to do exactly. I have also done some reading on how to enable caching through the serverless.yml template itself, or cloud formation, but the examples I find online don't seem to match up in any way to the structure of my serverless file or resulting CF template. (I can provide examples if required). I just want to be able to enable caching on path parameters. I have been able to enable caching globally on the API stage, but that won't help me unless I can get the caching to be sensitive to different path parameters.
serverless.yml
"GetTableResponse" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableResponse",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [ "AWSLambdaBasicExecutionRole","AWSLambdaVPCAccessExecutionRole","AmazonSSMFullAccess"],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "kata/table/get/{tableid}",
"Method": "GET"
}
}
}
}
}
},
"Outputs" : {
"ApiURL" : {
"Description" : "API endpoint URL for Prod environment",
"Value" : { "Fn::Sub" : "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" }
}
}
c# amazon-web-services caching aws-api-gateway
add a comment |
I have a serverless web API (API Gateway + Lambda) that I have built in C# and deployed via Visual Studio. This is achieved via a serverless.yml file that auto-creates a CloudFormation template, then that template is applied to create the API stack.
Once my stack is deployed, I have gone into the AWS Console to enable caching on one of the path parameters, but get this error:
!https://ibb.co/B4wmRRj
I'm aware of this post https://forums.aws.amazon.com/thread.jspa?messageID=711315򭪓 which details a similar but different issue where the user can't uncheck caching. My issue is I can't enable it to begin with. I also don't understand the steps provided to resolve the issue within that post. There is mention of using the AWS CLI, but not what commands to use, or what to do exactly. I have also done some reading on how to enable caching through the serverless.yml template itself, or cloud formation, but the examples I find online don't seem to match up in any way to the structure of my serverless file or resulting CF template. (I can provide examples if required). I just want to be able to enable caching on path parameters. I have been able to enable caching globally on the API stage, but that won't help me unless I can get the caching to be sensitive to different path parameters.
serverless.yml
"GetTableResponse" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableResponse",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [ "AWSLambdaBasicExecutionRole","AWSLambdaVPCAccessExecutionRole","AmazonSSMFullAccess"],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "kata/table/get/{tableid}",
"Method": "GET"
}
}
}
}
}
},
"Outputs" : {
"ApiURL" : {
"Description" : "API endpoint URL for Prod environment",
"Value" : { "Fn::Sub" : "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" }
}
}
c# amazon-web-services caching aws-api-gateway
1
Can you please share your snippet of serverless.yml file?. I can give you answer on how to do it via cli but want to see if its possible with serverless.yml.
– Imran
Dec 31 '18 at 15:45
Added to original question. the whole template is really just repeats of methods similar to the above, with the single output at the end of the url.
– JamesMatson
Jan 1 at 0:45
add a comment |
I have a serverless web API (API Gateway + Lambda) that I have built in C# and deployed via Visual Studio. This is achieved via a serverless.yml file that auto-creates a CloudFormation template, then that template is applied to create the API stack.
Once my stack is deployed, I have gone into the AWS Console to enable caching on one of the path parameters, but get this error:
!https://ibb.co/B4wmRRj
I'm aware of this post https://forums.aws.amazon.com/thread.jspa?messageID=711315򭪓 which details a similar but different issue where the user can't uncheck caching. My issue is I can't enable it to begin with. I also don't understand the steps provided to resolve the issue within that post. There is mention of using the AWS CLI, but not what commands to use, or what to do exactly. I have also done some reading on how to enable caching through the serverless.yml template itself, or cloud formation, but the examples I find online don't seem to match up in any way to the structure of my serverless file or resulting CF template. (I can provide examples if required). I just want to be able to enable caching on path parameters. I have been able to enable caching globally on the API stage, but that won't help me unless I can get the caching to be sensitive to different path parameters.
serverless.yml
"GetTableResponse" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableResponse",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [ "AWSLambdaBasicExecutionRole","AWSLambdaVPCAccessExecutionRole","AmazonSSMFullAccess"],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "kata/table/get/{tableid}",
"Method": "GET"
}
}
}
}
}
},
"Outputs" : {
"ApiURL" : {
"Description" : "API endpoint URL for Prod environment",
"Value" : { "Fn::Sub" : "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" }
}
}
c# amazon-web-services caching aws-api-gateway
I have a serverless web API (API Gateway + Lambda) that I have built in C# and deployed via Visual Studio. This is achieved via a serverless.yml file that auto-creates a CloudFormation template, then that template is applied to create the API stack.
Once my stack is deployed, I have gone into the AWS Console to enable caching on one of the path parameters, but get this error:
!https://ibb.co/B4wmRRj
I'm aware of this post https://forums.aws.amazon.com/thread.jspa?messageID=711315򭪓 which details a similar but different issue where the user can't uncheck caching. My issue is I can't enable it to begin with. I also don't understand the steps provided to resolve the issue within that post. There is mention of using the AWS CLI, but not what commands to use, or what to do exactly. I have also done some reading on how to enable caching through the serverless.yml template itself, or cloud formation, but the examples I find online don't seem to match up in any way to the structure of my serverless file or resulting CF template. (I can provide examples if required). I just want to be able to enable caching on path parameters. I have been able to enable caching globally on the API stage, but that won't help me unless I can get the caching to be sensitive to different path parameters.
serverless.yml
"GetTableResponse" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableResponse",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [ "AWSLambdaBasicExecutionRole","AWSLambdaVPCAccessExecutionRole","AmazonSSMFullAccess"],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "kata/table/get/{tableid}",
"Method": "GET"
}
}
}
}
}
},
"Outputs" : {
"ApiURL" : {
"Description" : "API endpoint URL for Prod environment",
"Value" : { "Fn::Sub" : "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" }
}
}
c# amazon-web-services caching aws-api-gateway
c# amazon-web-services caching aws-api-gateway
edited Jan 1 at 0:45
JamesMatson
asked Dec 30 '18 at 23:10
JamesMatsonJamesMatson
10013
10013
1
Can you please share your snippet of serverless.yml file?. I can give you answer on how to do it via cli but want to see if its possible with serverless.yml.
– Imran
Dec 31 '18 at 15:45
Added to original question. the whole template is really just repeats of methods similar to the above, with the single output at the end of the url.
– JamesMatson
Jan 1 at 0:45
add a comment |
1
Can you please share your snippet of serverless.yml file?. I can give you answer on how to do it via cli but want to see if its possible with serverless.yml.
– Imran
Dec 31 '18 at 15:45
Added to original question. the whole template is really just repeats of methods similar to the above, with the single output at the end of the url.
– JamesMatson
Jan 1 at 0:45
1
1
Can you please share your snippet of serverless.yml file?. I can give you answer on how to do it via cli but want to see if its possible with serverless.yml.
– Imran
Dec 31 '18 at 15:45
Can you please share your snippet of serverless.yml file?. I can give you answer on how to do it via cli but want to see if its possible with serverless.yml.
– Imran
Dec 31 '18 at 15:45
Added to original question. the whole template is really just repeats of methods similar to the above, with the single output at the end of the url.
– JamesMatson
Jan 1 at 0:45
Added to original question. the whole template is really just repeats of methods similar to the above, with the single output at the end of the url.
– JamesMatson
Jan 1 at 0:45
add a comment |
1 Answer
1
active
oldest
votes
--Update Start--
The reason, you are getting Invalid cache key parameter specified
error because you did not explicitly highlighted the path parameters section.
This is because, although the UI somehow extrapolated that there is a
path parameter, it has not been explicitly called out in the API
Gateway configuration.
I tested with below and was able to replicate the behavior on console. To resolve this, follow my Point 1
section full answer.
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
--Update End--
Here you go. I still don't have your exact serverless.yml so I created a sample of mine similar to yours and tested it.
serverless.yml
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
request:
parameters:
paths:
tableid: true
resources:
Resources:
ApiGatewayMethodKataTableGetTableidVarGet:
Properties:
Integration:
CacheKeyParameters:
- method.request.path.tableid
Above should make tableid
path parameter is cached.
Explanation:
Point 1. You have to make sure in your events after your method and path, below section is created otherwise next resources section of CacheKeyParameters will fail. Note - boolean true
means path parameter is required. Once you explicitly highlight path parameter, you should be able to enable caching via console as well without resources
section.
request:
parameters:
paths:
tableid: true
Point 2. The resources section tells API Gateway to enable caching on tableid
path parameter. This is nothing but serverless interpretation of CloudFormation template syntax. How did I get that I have to use ApiGatewayMethodKataTableGetTableidVarGet
to make it working?. Just read below guidelines and tip to get the name.
https://serverless.com/framework/docs/providers/aws/guide/resources/
Tip: If you are unsure how a resource is named, that you want to
reference from your custom resources, you can issue a serverless
package. This will create the CloudFormation template for your service
in the .serverless folder (it is named
cloudformation-template-update-stack.json). Just open the file and
check for the generated resource name.
What does above mean? - First run serverless package
without resources section and find .serverless
folder in directory and open above mentioned json file. Look for AWS::ApiGateway::Method
. you will get exact normalized name(ApiGatewayMethodKataTableGetTableidVarGet
) syntax you can use in resources section.
Here are some references I used.
https://medium.com/@dougmoscrop/i-set-up-api-gateway-caching-here-are-some-things-that-surprised-me-7526d954fbe6
https://serverless.com/framework/docs/providers/aws/events/apigateway#request-parameters
PS - If you still need CLI steps to enable it, let me know.
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
The reason, console is failing because you did not specify myPoint 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.
– Imran
Jan 1 at 2:37
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53982175%2finvalid-cache-key-parameter-specified-when-enabling-caching-for-a-path-parameter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
--Update Start--
The reason, you are getting Invalid cache key parameter specified
error because you did not explicitly highlighted the path parameters section.
This is because, although the UI somehow extrapolated that there is a
path parameter, it has not been explicitly called out in the API
Gateway configuration.
I tested with below and was able to replicate the behavior on console. To resolve this, follow my Point 1
section full answer.
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
--Update End--
Here you go. I still don't have your exact serverless.yml so I created a sample of mine similar to yours and tested it.
serverless.yml
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
request:
parameters:
paths:
tableid: true
resources:
Resources:
ApiGatewayMethodKataTableGetTableidVarGet:
Properties:
Integration:
CacheKeyParameters:
- method.request.path.tableid
Above should make tableid
path parameter is cached.
Explanation:
Point 1. You have to make sure in your events after your method and path, below section is created otherwise next resources section of CacheKeyParameters will fail. Note - boolean true
means path parameter is required. Once you explicitly highlight path parameter, you should be able to enable caching via console as well without resources
section.
request:
parameters:
paths:
tableid: true
Point 2. The resources section tells API Gateway to enable caching on tableid
path parameter. This is nothing but serverless interpretation of CloudFormation template syntax. How did I get that I have to use ApiGatewayMethodKataTableGetTableidVarGet
to make it working?. Just read below guidelines and tip to get the name.
https://serverless.com/framework/docs/providers/aws/guide/resources/
Tip: If you are unsure how a resource is named, that you want to
reference from your custom resources, you can issue a serverless
package. This will create the CloudFormation template for your service
in the .serverless folder (it is named
cloudformation-template-update-stack.json). Just open the file and
check for the generated resource name.
What does above mean? - First run serverless package
without resources section and find .serverless
folder in directory and open above mentioned json file. Look for AWS::ApiGateway::Method
. you will get exact normalized name(ApiGatewayMethodKataTableGetTableidVarGet
) syntax you can use in resources section.
Here are some references I used.
https://medium.com/@dougmoscrop/i-set-up-api-gateway-caching-here-are-some-things-that-surprised-me-7526d954fbe6
https://serverless.com/framework/docs/providers/aws/events/apigateway#request-parameters
PS - If you still need CLI steps to enable it, let me know.
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
The reason, console is failing because you did not specify myPoint 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.
– Imran
Jan 1 at 2:37
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
add a comment |
--Update Start--
The reason, you are getting Invalid cache key parameter specified
error because you did not explicitly highlighted the path parameters section.
This is because, although the UI somehow extrapolated that there is a
path parameter, it has not been explicitly called out in the API
Gateway configuration.
I tested with below and was able to replicate the behavior on console. To resolve this, follow my Point 1
section full answer.
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
--Update End--
Here you go. I still don't have your exact serverless.yml so I created a sample of mine similar to yours and tested it.
serverless.yml
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
request:
parameters:
paths:
tableid: true
resources:
Resources:
ApiGatewayMethodKataTableGetTableidVarGet:
Properties:
Integration:
CacheKeyParameters:
- method.request.path.tableid
Above should make tableid
path parameter is cached.
Explanation:
Point 1. You have to make sure in your events after your method and path, below section is created otherwise next resources section of CacheKeyParameters will fail. Note - boolean true
means path parameter is required. Once you explicitly highlight path parameter, you should be able to enable caching via console as well without resources
section.
request:
parameters:
paths:
tableid: true
Point 2. The resources section tells API Gateway to enable caching on tableid
path parameter. This is nothing but serverless interpretation of CloudFormation template syntax. How did I get that I have to use ApiGatewayMethodKataTableGetTableidVarGet
to make it working?. Just read below guidelines and tip to get the name.
https://serverless.com/framework/docs/providers/aws/guide/resources/
Tip: If you are unsure how a resource is named, that you want to
reference from your custom resources, you can issue a serverless
package. This will create the CloudFormation template for your service
in the .serverless folder (it is named
cloudformation-template-update-stack.json). Just open the file and
check for the generated resource name.
What does above mean? - First run serverless package
without resources section and find .serverless
folder in directory and open above mentioned json file. Look for AWS::ApiGateway::Method
. you will get exact normalized name(ApiGatewayMethodKataTableGetTableidVarGet
) syntax you can use in resources section.
Here are some references I used.
https://medium.com/@dougmoscrop/i-set-up-api-gateway-caching-here-are-some-things-that-surprised-me-7526d954fbe6
https://serverless.com/framework/docs/providers/aws/events/apigateway#request-parameters
PS - If you still need CLI steps to enable it, let me know.
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
The reason, console is failing because you did not specify myPoint 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.
– Imran
Jan 1 at 2:37
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
add a comment |
--Update Start--
The reason, you are getting Invalid cache key parameter specified
error because you did not explicitly highlighted the path parameters section.
This is because, although the UI somehow extrapolated that there is a
path parameter, it has not been explicitly called out in the API
Gateway configuration.
I tested with below and was able to replicate the behavior on console. To resolve this, follow my Point 1
section full answer.
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
--Update End--
Here you go. I still don't have your exact serverless.yml so I created a sample of mine similar to yours and tested it.
serverless.yml
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
request:
parameters:
paths:
tableid: true
resources:
Resources:
ApiGatewayMethodKataTableGetTableidVarGet:
Properties:
Integration:
CacheKeyParameters:
- method.request.path.tableid
Above should make tableid
path parameter is cached.
Explanation:
Point 1. You have to make sure in your events after your method and path, below section is created otherwise next resources section of CacheKeyParameters will fail. Note - boolean true
means path parameter is required. Once you explicitly highlight path parameter, you should be able to enable caching via console as well without resources
section.
request:
parameters:
paths:
tableid: true
Point 2. The resources section tells API Gateway to enable caching on tableid
path parameter. This is nothing but serverless interpretation of CloudFormation template syntax. How did I get that I have to use ApiGatewayMethodKataTableGetTableidVarGet
to make it working?. Just read below guidelines and tip to get the name.
https://serverless.com/framework/docs/providers/aws/guide/resources/
Tip: If you are unsure how a resource is named, that you want to
reference from your custom resources, you can issue a serverless
package. This will create the CloudFormation template for your service
in the .serverless folder (it is named
cloudformation-template-update-stack.json). Just open the file and
check for the generated resource name.
What does above mean? - First run serverless package
without resources section and find .serverless
folder in directory and open above mentioned json file. Look for AWS::ApiGateway::Method
. you will get exact normalized name(ApiGatewayMethodKataTableGetTableidVarGet
) syntax you can use in resources section.
Here are some references I used.
https://medium.com/@dougmoscrop/i-set-up-api-gateway-caching-here-are-some-things-that-surprised-me-7526d954fbe6
https://serverless.com/framework/docs/providers/aws/events/apigateway#request-parameters
PS - If you still need CLI steps to enable it, let me know.
--Update Start--
The reason, you are getting Invalid cache key parameter specified
error because you did not explicitly highlighted the path parameters section.
This is because, although the UI somehow extrapolated that there is a
path parameter, it has not been explicitly called out in the API
Gateway configuration.
I tested with below and was able to replicate the behavior on console. To resolve this, follow my Point 1
section full answer.
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
--Update End--
Here you go. I still don't have your exact serverless.yml so I created a sample of mine similar to yours and tested it.
serverless.yml
functions:
katatable:
handler: handler.katatable
events:
- http:
method: get
path: kata/table/get/{tableid}
request:
parameters:
paths:
tableid: true
resources:
Resources:
ApiGatewayMethodKataTableGetTableidVarGet:
Properties:
Integration:
CacheKeyParameters:
- method.request.path.tableid
Above should make tableid
path parameter is cached.
Explanation:
Point 1. You have to make sure in your events after your method and path, below section is created otherwise next resources section of CacheKeyParameters will fail. Note - boolean true
means path parameter is required. Once you explicitly highlight path parameter, you should be able to enable caching via console as well without resources
section.
request:
parameters:
paths:
tableid: true
Point 2. The resources section tells API Gateway to enable caching on tableid
path parameter. This is nothing but serverless interpretation of CloudFormation template syntax. How did I get that I have to use ApiGatewayMethodKataTableGetTableidVarGet
to make it working?. Just read below guidelines and tip to get the name.
https://serverless.com/framework/docs/providers/aws/guide/resources/
Tip: If you are unsure how a resource is named, that you want to
reference from your custom resources, you can issue a serverless
package. This will create the CloudFormation template for your service
in the .serverless folder (it is named
cloudformation-template-update-stack.json). Just open the file and
check for the generated resource name.
What does above mean? - First run serverless package
without resources section and find .serverless
folder in directory and open above mentioned json file. Look for AWS::ApiGateway::Method
. you will get exact normalized name(ApiGatewayMethodKataTableGetTableidVarGet
) syntax you can use in resources section.
Here are some references I used.
https://medium.com/@dougmoscrop/i-set-up-api-gateway-caching-here-are-some-things-that-surprised-me-7526d954fbe6
https://serverless.com/framework/docs/providers/aws/events/apigateway#request-parameters
PS - If you still need CLI steps to enable it, let me know.
edited Jan 1 at 19:51
answered Jan 1 at 2:29


ImranImran
1,3071823
1,3071823
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
The reason, console is failing because you did not specify myPoint 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.
– Imran
Jan 1 at 2:37
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
add a comment |
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
The reason, console is failing because you did not specify myPoint 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.
– Imran
Jan 1 at 2:37
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
Thanks Imran, I'll look through all of this. Though, can I ask one question - was my approach via the console wrong? Or is there just some kind of bug / defect within the console that won't allow setting the cache up via it?
– JamesMatson
Jan 1 at 2:34
The reason, console is failing because you did not specify my
Point 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.– Imran
Jan 1 at 2:37
The reason, console is failing because you did not specify my
Point 1
section in your yaml. Check the medium article I shared, author got same error and he gave reason. Atleast that's what I thought. Once you are also able to resolve the issue. Please upvote and accept answer!!.– Imran
Jan 1 at 2:37
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
@JamesMatson I was able to replicate the console error on what went wrong and updated my answer. Let me know!!.
– Imran
Jan 1 at 19:52
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53982175%2finvalid-cache-key-parameter-specified-when-enabling-caching-for-a-path-parameter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you please share your snippet of serverless.yml file?. I can give you answer on how to do it via cli but want to see if its possible with serverless.yml.
– Imran
Dec 31 '18 at 15:45
Added to original question. the whole template is really just repeats of methods similar to the above, with the single output at the end of the url.
– JamesMatson
Jan 1 at 0:45