serverless-apigateway-service-proxy icon indicating copy to clipboard operation
serverless-apigateway-service-proxy copied to clipboard

API gateway apiKeys not generated

Open maxm450 opened this issue 2 years ago • 3 comments

API keys are not generated even if those are passed inside the provider section:

I would expect that the API gateway would use the api key name defined inside the provider section. Same as https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#setting-api-keys-for-your-rest-api

serverless: 3.16.0 serverless-apigateway-service-proxy: 2.1.0

yml: `service: test-integration

plugins:

  • serverless-apigateway-service-proxy

custom: apiGatewayServiceProxies: - dynamodb: path: /dynamodb/{id} method: put tableName: ${EXISTING_TABLE_ARN} hashKey: pathParam: id attributeType: S action: PutItem cors: true private: true

AWS provider configuration

provider: name: aws region: us-east-1 stage: dummy apiGateway: apiKeys: - name: test value: 12345 `

maxm450 avatar May 09 '22 19:05 maxm450

I'm having a similar issue. Everything works well but no API keys are generated.

...
provider:
  name: aws
  stage: ${opt:stage, 'dev'}
  runtime: nodejs12.x
  apiGateway:
    apiKeys:
      - ${self:provider.stage}-myKey
    shouldStartNameWithService: true

custom:
  apiGatewayServiceProxies:
    - sqs:
        path: /test
        method: post
        queueName: { 'Fn::GetAtt': ['TestQueue', 'QueueName'] }
        private: true
...

I was able to find something which may work here: https://github.com/serverless/serverless/issues/4928

Is this how others are doing it now?

mkint avatar May 19 '22 21:05 mkint

I got mine to work by removing apiGateway and have apiKeys directly underneath provider. Also I have a usage plan although not sure that is required.

wezside avatar May 25 '22 10:05 wezside

I got mine to work by removing apiGateway and have apiKeys directly underneath provider. Also I have a usage plan although not sure that is required.

That worked for me as well. I don't have a usage plan, so just moving apiKeys directly under provider seems to solve it.

pnaw94 avatar Jan 22 '23 03:01 pnaw94