serverless / serverless/serverless
API gateway generated key name not prefixed with stage
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.9k
- Forks
- 5.7k
- Avg merge
- 10h 7m
- Merged PRs (30d)
- 57
Description
Context: https://serverless-contrib.slack.com/archives/CA4QT5VU3/p1564126720163800
The generated resource name for API gateway keys (e.g. "ApiGatewayApiKey1") doesn't contain service/stage, so it conflicts if you deploy your app to more than one stage
config:
apiKeys:
- name: "${self:custom.stackName}-key1"
value: 'blah blah'
description: Api key description
name is not used for generating the resource name.
outputs:
"ApiGatewayApiKey1": {
"Type": "AWS::ApiGateway::ApiKey",
"Properties": {
"Enabled": true,
"Name": "qc-dev-key1",
"Value": "blah blah",
"Description": "Api key description",
"StageKeys": [
{
"RestApiId": {
"Ref": "ApiGatewayRestApi"
},
"StageName": "dev"
}
Error:
An error occurred: ApiGatewayApiKey1 - API Key already exists (Service: AmazonApiGateway; Status Code: 409; Error Code: ConflictException;).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the API Gateway API key resource generation and reproduce the reported CloudFormation output for multiple stages. Verify that the generated resource name is stage-specific while the configured key Name, Value, Description, and StageKeys remain correct; done when deployments to different stages no longer conflict.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100