# API Keys must be strings error

**URL:** <https://forum.serverless.com/t/api-keys-must-be-strings-error/9076>\
**Category:** Serverless Framework\
**Tags:** aws, api-gateway\
**Created:** [August 15, 2019, 4:32am UTC](https://forum.serverless.com/t/api-keys-must-be-strings-error/9076 "2019-08-15T04:32:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thrixton](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/thrixton/32/2603_2.png) [@thrixton](https://forum.serverless.com/u/thrixton)\
**Post date:** [August 15, 2019, 4:32am UTC](https://forum.serverless.com/t/api-keys-must-be-strings-error/9076/1 "2019-08-15T04:32:41Z")

</div>

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](https://github.com/serverless/serverless/blob/master/docs/providers/aws/events/apigateway.md), we should be able to define API keys as below for a private API gateway endpoint.

```yml
  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

```yml
  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?
