API Keys must be strings error

I’m trying to store API keys in environment variables and then have these passed through to APIG when deploying with serverless.
The name should be auto-generated to prevent clashes.

Per the documentation, we should be able to define API keys as below for a private API gateway endpoint.

  apiKeys:
    - value: ${env:PROJECT_API_KEY01}
      description: PROJECT_API_KEY01
      enabled: true

However, when I run serverless package, this gives an error ServerlessError: API Keys must be strings
NOTE: This works when I run serverless deploy

This format work, however it’s then not possible to provide a description

  apiKeys:
    - 'JKHSDGFOSIUFGHOISWUDFGHOSIPUEDGFOWISUYGFOIUWEYHGFW'

Edit: The above actually just populates the name of the key, not the value as I first thought

Any idea why this would be?

1 Like