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

Cannot use Authorizer ARN #109

Open
mwillfox opened this issue Mar 14, 2018 · 11 comments
Open

Cannot use Authorizer ARN #109

mwillfox opened this issue Mar 14, 2018 · 11 comments
Labels

Comments

@mwillfox
Copy link

I'm having an issue where I'm attempting to use an ARN for my authorizer (all of my services share a common authorizer) but the plugin is inserting ${stageVariables.SERVERLESS_ALIAS} where it does not belong, in front of the ARN. Is this a bug or do I need to do something special in the yaml to tell serverless-aws-alias to not attempt to modify the ARN? I believe the preferred behavior would be if an ARN was provided for the authorizer to pass it through unmodified because it exists outside of this stack.

@HyperBrain
Copy link
Member

Hi @defendertx , yes you're right. External references should not be altered but just used as is.

I recently merged PR #102 and think that addresses exactly your problem. Can you try with the master branch of the project and confirm that it works for you?

"serverless-aws-alias": "github:HyperBrain/serverless-aws-alias#master"

@mwillfox
Copy link
Author

Master works as expected. Thanks!

@HyperBrain
Copy link
Member

Good to know. I'll do a release soon.

@HyperBrain HyperBrain added this to the 1.7.0 milestone Mar 14, 2018
@ColeTMNZ
Copy link

I've tried master to avoid this issue, and have not had any success as yet.

my authorizer arn is serverless custom var, in turn is a collections of serverless vars forming a string, some of which are ${cf.:authorizer-arn} type vars. Im wondering if its the cf import that may be throughing this off.

@HyperBrain
Copy link
Member

@ColeTMNZ The CF resolution in Serverless should resolve before the alias plugin is used. But could you do a serverless package and check in the generated .serverless/cloudformation......json if the arn in the function/permission resources is the expected arn?

@ColeTMNZ
Copy link

Heres my authorizer resource. Is it possibly the join that's throwing errors?

"AuthorizerApiGatewayAuthorizer": {
      "Type": "AWS::ApiGateway::Authorizer",
      "Properties": {
        "AuthorizerResultTtlInSeconds": 0,
        "IdentitySource": "method.request.header.x-tmnz-api-key",
        "Name": "authorizer",
        "RestApiId": {
          "Ref": "ApiGatewayRestApi"
        },
        "IdentityValidationExpression": ".*",
        "AuthorizerUri": {
          "Fn::Join": [
            "",
            [
              "arn:aws:apigateway:",
              {
                "Ref": "AWS::Region"
              },
              ":lambda:path/2015-03-31/functions/",
              {
                "Fn::Sub": "arn:aws:lambda:${AWS::Region}:xxyyzz:function:authorizer-service-dev-authorizer"
              },
              "/invocations"
            ]
          ]
        },
        "Type": "TOKEN"
      }
    },

@HyperBrain
Copy link
Member

HyperBrain commented Mar 15, 2018

@ColeTMNZ Yes it is. I think we have to improve the detection algorithm for external authorizers, because right now it seems to miss this case.

@aleksdikanski
Copy link

I think this is the same issue I raise in #112. Should be fixed with #113

@HyperBrain HyperBrain modified the milestones: 1.7.0, 1.6.2 Mar 20, 2018
@HyperBrain HyperBrain added the bug label Mar 20, 2018
@HyperBrain
Copy link
Member

@ColeTMNZ Can you try with the master branch if the issue is solved. I just merged #113 .

If it solved your problem, I'll close this one and will release 1.6.2.

@ColeTMNZ
Copy link

I believe I confirmed this worked. My stack gets a lot further in the creation process, and fails on other unrelated issues now. (alias & domain manager, alias and step functions)

I checked the cloud formation template and the Authorizer Resources were correctly created. (before being removed due to other mentioned errors)

@HyperBrain HyperBrain modified the milestones: 1.6.2, 1.7.0 Mar 22, 2018
@HyperBrain
Copy link
Member

I'll target this for 1.7+.

@HyperBrain HyperBrain removed this from the 1.7.0 milestone Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants