-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default value of Method RequestParameters from {} to true #132
Conversation
Currently experiencing this in our deployment pipeline. Why is this suddently an issue? have AWS changed their Cloud Formation validation? |
That is surprising to our team as well. We have had a service running for a long time until this week we noticed the pipeline failing due to this plugin. |
Hi @geetchoubey, Thanks for raising this issue and creating a fix. I haven't been able to reproduce the problem you've seen, but the plugin works fine with your changes, so I'll just create a release and see what happens 😄 |
Released in this version. |
From the AWS docs linked above:
As this PR changed the default value to true, doesnt this mean that optional parameters I want to add to the I am seeing in my lambda functions, parameters which were previously not required are now required. |
You make a valid point and I am not entirely sure how it was dealt before, but I tried out an additional flag # serverless.yml
cors: true
caching:
enabled: true
cacheKeyParameters:
- name: request.querystring.required # Final value in API GW: True
required: true
- name: request.querystring.notrequired # Final value in API GW: False
required: false
- name: request.querystring.letssee # Final value in API GW: False
// src/cacheKeyParameters.js
const isRequired = cacheKeyParameter.required || false;
...
method.Properties.RequestParameters[`method.${cacheKeyParameter.name}`] = (existingValue == null || existingValue == undefined) ? isRequired : existingValue; // cloudformation-stack.json
"ApiGatewayMethodAnotherGet": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "GET",
"RequestParameters": {
"method.request.querystring.required": true,
"method.request.querystring.notrequired": false,
"method.request.querystring.letssee": false
},
} |
Per the AWS documentation, method.Properties.RequestParameters only accepts a string;boolean pair object.
The issue:
When using the plugin like:
The plugin modifies the cloudformation:
Which leads to the following error:
This PR changes the default values to
true
instead of{}
and updates related unit tests.