question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaking change introduced for Custom Authorizer Lambdas

See original GitHub issue

Bug Report

Merged PR https://github.com/serverless/serverless/commit/38f6ac125e54d927871b4e5f5b387e0d4c28a6a7 introduced breaking changes for lambda based custom authorizer.

Description

Given I am running serverless v1.60.5 When I run sls deploy Then the deploy fails because the “cloudformation-template-update-stack.json” file has an incorrect datatype in place for the FunctionName of the Authorizerr Function Error: An error occurred: CustomAuthorizerLambdaPermissionApiGateway - Value of property FunctionName must be of type String.

Source code that changed https://github.com/serverless/serverless/blob/38f6ac125e54d927871b4e5f5b387e0d4c28a6a7/lib/plugins/aws/package/compile/events/apiGateway/lib/permissions.js commit #38f6ac1

Resultant Cloudformation code showing that FunctionName isn’t a String variable:

"CustomAuthorizerLambdaPermissionApiGateway": {
      "Type": "AWS::Lambda::Permission",
      "Properties": {
        "FunctionName": {
          "Fn::Join": [
            ":",
            [
              {
                "Fn::GetAtt": [
                  "CustomAuthorizerLambdaFunction",
                  "Arn"
                ]
              }
            ]
          ],
          "Fn::GetAtt": [
            "CustomAuthorizerLambdaFunction",
            "Arn"
          ]
        },
  1. What did you do? Updated serverless from v1.59.3 to v1.60.5
  2. What happened? Deploys started to fail because the CustomAuthorizer function could not be deployed
  3. What should’ve happened? It should have delpoyed, like it previously had done for the past 18 months.
  4. What’s the content of your serverless.yml file? Pasting in the relevant data:
frameworkVersion: ">=1.1.0 <2.0.0"

provider:
  name: aws
  runtime: python3.7
  stage: ${opt:stage,'dev'}
  region: eu-west-1
  tracing:
    lambda: true
    apiGateway: true
plugins:
  - serverless-python-requirements
  - serverless-stage-manager
  - serverless-prune-plugin

functions:
  customAuthorizer:
    handler: authorizer.auth
    events:
        - http:
            path: /auth
            method: GET
            cors: true

  1. What’s the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy) Serverless Error ---------------------------------------

An error occurred: CustomAuthorizerLambdaPermissionApiGateway - Value of property FunctionName must be of type String.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information --------------------------- Operating System: darwin Node Version: 11.13.0 Framework Version: 1.60.5 Plugin Version: 3.2.7 SDK Version: 2.2.1 Components Core Version: 1.1.2 Components CLI Version: 1.4.0

Similar or dependent issues: The change to the relevant code was introduced as a result of the PR raised from issue:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DrColzacommented, Jan 9, 2020

The patch works for fixing the issue of being able to deploy. Approved.

With regards to the customAuthorizer error I’m getting, I will raise another issue if i need to. I need to spend more time troubleshooting it.

Thanks @medikoo

0reactions
medikoocommented, Jan 9, 2020

@DrColza sorry, but it’s not clear for me from above description, whether you’re still facing any issues (?)

If you feel given fix is not sufficient can you explain why, and post an exact error you’re receiving?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use API Gateway Lambda authorizers - AWS Documentation
A Lambda authorizer (formerly known as a custom authorizer) is an API Gateway feature that uses a Lambda function to control access to...
Read more >
The Complete Guide to Custom Authorizers with AWS ...
In this post, you'll learn about using API Gateway custom authorizers. This post covers: Background on custom authorizers and their benefits ...
Read more >
Amazon API Gateway + Custom Authorizer + OAuth - Authlete
In this document, we use the term "Custom Authorizer", which has been renamed as "Lambda Authorizer". Before Custom Authorizer was introduced, introspection and ......
Read more >
How to throw custom error message from API Gateway custom ...
Since the original poster is raising a raw Exception , the lambda authorization function errors out, which means it returns a 500 error....
Read more >
Upgrading to Serverless Framework v3
Breaking changes · CLI commands and options · Service configuration · API Gateway · CloudFront · EventBridge · KMS · Alexa skill ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found