serverless / serverless/serverless

AWS API Gateway: Lack of support for CF intrinsic functions at `functions[].events[].http.authorizer.arn`

Open
#3,212 67 comments 44 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug/design cat/aws-event-api-gateway good first issue help wanted
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

  • What was the config you used?
functions:
  myFunction:
    handler: handler.myFunction
    events:
      - http:
          ...
          authorizer:
            arn: { "Fn::Join" : [ ":", [ "arn:aws:lambda", { "Ref" : "AWS::Region" }, { "Ref" : "AWS::AccountId" }, "function:myAuthorizer" ] ] }
            ...
  • What stacktrace or error message from your provider did you see?
Serverless: Packaging service...

  Type Error ---------------------------------------------

     functionArn.split is not a function

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

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

     Please report this error. We think it might be a bug.

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       4.3.2
     Serverless Version: 1.6.1

Similar or dependent issues:

  • #3129

Additional Data

  • Serverless Framework Version you're using: 1.6.1
  • Operating System: macOS Sierra 10.12.3

Proposed solution:

This report signals two issues:

1. Messed up error reporting (functionArn.split is not a function)

No need to do anything here, as such errors will be handled neatly, once schema is configured for this event (see: https://github.com/serverless/serverless/issues/8018)

2. No support for CF intrinsic functions at authorizer.arn.

See: https://github.com/serverless/serverless/issues/3212#issuecomment-696637248

  1. When arn is passed in object form, require name property (validate it's existence inline, at least it might be hard to validate it with schema, and receive human friendly error message).
  2. When arn is passed in string form and no name is passed. deprecate name resolution with message that it won't be auto-resolved in next major and to have authorizer named, name has to be explicitly set in config

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the authorizer ARN handling for functions[].events[].http.authorizer.arn and review the related issue #3129 and discussion linked in the report. Done means CloudFormation intrinsic-function objects are supported, object-form ARNs require an explicit name, and string-form ARNs without a name produce the proposed deprecation guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.