Hi,
I’m trying to migrate our serverless projects from V2 to V3, and I’m struggling with API Keys a bit. In our V2 project, we defined the name and value of the API Keys, and when we deployed, it would see that the key already exists and carry on with the deployment. Now in V3, it is giving me an error because the name already exists, and if I append the stage to the name (${sls:stage}), as I saw suggested in the documentation, it’s complaining that the value already exists.
I have moved the definitions under “provider.apiGateway.apiKeys” in my main serverless.yml file. Below is the relevant section from serverless.yml (with values changed to protect the innocent):
provider:
name: aws
runtime: java11
timeout: 30
versionFunctions: false
stage: dev
apiGateway:
restApiId:
Ref: CasApiGateway
restApiRootResourceId:
Fn::GetAtt:
- CasApiGateway
- RootResourceId
apiKeySourceType: HEADER
apiKeys:
- name: Name1
value: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
description: "Description"
How are the API Keys supposed to work in V3 if you can’t redeploy them??