Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: apiKeyDefinition[name].forEach is not a function #53

Open
satyami2tech opened this issue Aug 10, 2022 · 0 comments
Open

TypeError: apiKeyDefinition[name].forEach is not a function #53

satyami2tech opened this issue Aug 10, 2022 · 0 comments

Comments

@satyami2tech
Copy link

Here is my code for setting up API keys.

service: thirdparty-api
frameworkVersion: "^3.19.0"

plugins:
  - serverless-add-api-key

provider:
  name: aws
  runtime: nodejs14.x
  tags:
    version: v0.0.1
  stage: ${opt:stage, 'dev'}
  deploymentBucket: serverless-deployment
  region: 'us-west-2'
  logs:
    restApi: true
  vpc:
    securityGroupIds:
      - SG
    subnetIds:
      - SUB_NET1 #Private Subnet
      - SUB_NET2 #Private Subnet
  apiGateway:
    apiKeys:
      - name: privateSertifiKey
        value: 'valueofkeyhere'
        usagePlan:
          - name: privateSertifi
            quota:
              limit: 1000000
              period: MONTH
            throttle:
              rateLimit: 1000
              burstLimit: 500

and in function yaml, I've added private as true for respective method.

At build time, it is throwing this error.

Error:
TypeError: apiKeyDefinition[name].forEach is not a function
at /codebuild/output/src276954272/src/thirdparty-api/node_modules/serverless/lib/plugins/aws/package/compile/events/api-gateway/lib/api-keys.js:49:34
at Array.forEach (<anonymous>)
at AwsCompileApigEvents.compileApiKeys (/codebuild/output/src276954272/src/thirdparty-api/node_modules/serverless/lib/plugins/aws/package/compile/events/api-gateway/lib/api-keys.js:39:15)
at AwsCompileApigEvents.tryCatcher (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/codebuild/output/src276954272/src/thirdparty-api/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:464:21)

@satyami2tech satyami2tech changed the title TypeError: apiKeyDefinition[name].forEach is not a functio TypeError: apiKeyDefinition[name].forEach is not a function Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant