On deploy, AWS error "Invalid API Key identifier specified"

When attempting a deploy, I am seeing “Invalid API Key identifier specified”. I ran a drift report, which doesn’t indicate any drift on the API key. How can I resolve this?

The relevant portion of serverless.yml is:

provider:
  name: aws
  apiGateway:
    apiKeys:
      - ${self:custom.namespace}-admin

custom:
  namespace: ${self:service}_${sls:stage}

The error didn’t occur on ‘dev’ but is on ‘prod’.

Still not sure what precipitated this problem, but we did find a solution. In one case, we could not tolerate the value of the key changing, so we had to use this syntax to lock in the value:

        apiGateway:
          apiKeys:
            - name: ${self:custom.namespace}-agent
              value: ${env:AGENT_API_TOKEN}

In either case, I first removed the apiKeys section and deployed it to erase any reference to the keys. Then I manually removed the keys in the AWS API Gateway console. Then I re-added the apiKeys section and deployed successfully. Would have liked to be able to fix this without down time, but in this situation it was not a big problem.