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

Purpose of env.AUTHORIZER #1764

Open
adamldoyle opened this issue Feb 27, 2024 · 0 comments
Open

Purpose of env.AUTHORIZER #1764

adamldoyle opened this issue Feb 27, 2024 · 0 comments

Comments

@adamldoyle
Copy link

adamldoyle commented Feb 27, 2024

I'm curious about the full purpose of env.AUTHORIZER for mocking remote authorizers. From what I can tell, even with that environment variable set the authorizer is still validated and ran, but then the authorizer result is discarded in favor of the mocked value in the environment variable. It seems there'd be value in bypassing the entire authorization process and just immediately returning the mocked value to support use-cases that currently don't work. I can't tell if this was the intent of the environment variable or if the current functionality is preferred.

For example, the following use-case doesn't work since it relies on referencing an authorizer function by ARN:

provider:
  name: aws
  httpApi:
    authorizers:
      httpApiAuthorizer:
        type: request
        functionArn: arn:aws:lambda:...
        resultTtlInSeconds: 0

functions:
  httpTestCall:
    handler: src/testCall.handler
    events:
      - httpApi:
         method: GET
         path: /test
         authorizer:
            name: httpApiAuthorizer

However, if env.AUTHORIZER skipped hooking up the actual authorizer, it wouldn't matter what authorizer was used since the result is mocked anyway.

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