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

Usage plan not supported for implicit APIs #1513

Closed
mcintyre94 opened this issue Mar 12, 2020 · 1 comment
Closed

Usage plan not supported for implicit APIs #1513

mcintyre94 opened this issue Mar 12, 2020 · 1 comment

Comments

@mcintyre94
Copy link

mcintyre94 commented Mar 12, 2020

Description:

Usage plans for auth on APIs was added in #1141

Looking at ApiAuth docs (the Auth field on AWS::Serverless::Api objects) - https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-api-apiauth.html - the UsagePlan field is present.

But implicit APIs (Api events under AWS::Serverless::Function) - https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-apifunctionauth.html - are missing that field. So the APIs produced by Lambda functions in SAM don't seem to support this field, which would be useful. Is it possible to support it?

Steps to reproduce the issue:

Add to a SAM template:

  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: lambdas/my-function
      Handler: index.lambdaHandler
      Runtime: nodejs12.x
      Events:
        MyFunctionApi:
          Type: Api
          Properties:
            Path: /my-function
            Method: post
            Auth:
              ApiKeyRequired: true
              UsagePlan:
                CreateUsagePlan: PER_API

Observed result:

When deployed, this API is created, but no usage plan or API key are.

Expected result:

The API is created, with a usage plan and API key - in the same way they would if it was a top-level API object, as described in #1141

@ShreyaGangishetty
Copy link

@mcintyre94 for setting UsagePlan for Implicit API please add it in Globals or else UsagePlan can only be used with explicit Apis.

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

2 participants