Search code examples
amazon-web-servicesaws-lambdaaws-api-gatewayserverless-framework

Serverless | How to set Lambda authorizer to None (public API)


Please consider the following code (serverless.yml):

functions:
  exportCvToPdf:
    handler: handler.exportCvToPdf
    timeout: 20
    events:
      - http:
          path: export
          method: post

Deploying to AWS returns a link to the API endpoint. CURL'ing the endpoint returns:

{"message":"Missing Authentication Token"}

How can I make a public endpoint using Serverless Framework?

I have tried the following:

functions:
  exportCvToPdf:
    handler: handler.exportCvToPdf
    timeout: 20
    events:
      - http:
          path: export
          method: post
          authorizer: none # None NONE "none" "NONE" "None" has also been tried

The above returns an error at deploy:

Function none doesn't exist in this Service

Solution

  • You should be able to just omit authorizer and your endpoint will be publicly accessible right after deployment. Ensure that you're calling proper URL with proper path and method. Could you share how are you calling the deployed endpoint?