matewilk
matewilk

Reputation: 1301

Serverless apiKey error API Keys must be strings

I have a requirement to create a usagePlan for an endpoint with two different apiKeys.

This is the piece of config that gives me a lot of headache:

apiKeys:
    - android:
        - android
        - ${self:provider.stage}-android
    - ios:
        - ios
        - ${self:provider.stage}-ios
  usagePlan:
    - android:
        quota:
          limit: 500
          offset: 2
          period: MONTH
        throttle:
          burstLimit: 20
          rateLimit: 10
    - ios:
        quota:
          limit: 5000
          offset: 1
          period: MONTH
        throttle:
          burstLimit: 200
          rateLimit: 100

This is taken from the serverless docs from here

I tried all the varieties from the docs and all the possibilities but one give me the following error:

Serverless Error ---------------------------------------

API Keys must be strings

And the one that works look like this:

apiKeys:
 - android
 - ios
usagePlan:
  ...

Which doesn't work for me because I need to have 2 keys that are parametrised with the environment name.

I tried all the variations from the docs and it seems nothing works.

Any help greatly appreciated.

Thanks!

Upvotes: 0

Views: 534

Answers (1)

user625626
user625626

Reputation: 1112

Resolved the issue by updating the serverless framework to the most current version (1.49.0 in my case) using

npm install [email protected] -g

Upvotes: 2

Related Questions