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

Policy count should be 1 #21

Closed
SantourA opened this issue Mar 25, 2017 · 16 comments
Closed

Policy count should be 1 #21

SantourA opened this issue Mar 25, 2017 · 16 comments
Assignees
Labels

Comments

@SantourA
Copy link

Getting the following error when trying to execute my initial deploy using "sls deploy -s dev -r us-east-1"

Error --------------------------------------------------

 Policy count should be 1! Please report this error to
 the alias plugin owner.

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

Stack Trace --------------------------------------------

Error: Policy count should be 1! Please report this error to the alias plugin owner.
at AwsAlias.aliasHandleLambdaRole (C:\Apps\Workspaces\Development\Services\development\Services\apitest\nodejs\node_modules\serverless-aws-alias\lib\aliasRestructureStack.js:396:28)
at runCallback (timers.js:649:20)
at tryOnImmediate (timers.js:622:5)
at processImmediate [as _immediateCallback] (timers.js:594:5)
From previous event:
at PluginManager.run (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:156:22)
at Serverless.run (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:95:31)
at serverless.init.then (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\serverless\bin\serverless:23:50)

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: win32
Node Version: 6.9.4

@HyperBrain
Copy link
Member

HyperBrain commented Mar 27, 2017

Which Serverless version and which alias plugin version are you using?
I had a bug in the plugin where upgrading from Serverless 1.6 to 1.8/1.9 led to an error. Should be fixed in the 0.3.4 plugin version. Please check that, and in case it does not work, can you share some information about your service YAML file? Especially if you customized something in regards to the IAM role/policy configurations.

@SantourA
Copy link
Author

SantourA commented Mar 27, 2017 via email

@HyperBrain
Copy link
Member

Thanks for the YAML. I will investigate the issue with the given file. Hopefully I can reproduce it and find the bug soon.

@HyperBrain HyperBrain added the bug label Mar 27, 2017
@HyperBrain HyperBrain self-assigned this Mar 27, 2017
@HyperBrain
Copy link
Member

Update: I have the assumption that it has something to do with the custom authorizer. I think I missed that while implementing the stack transforms.

@SantourA
Copy link
Author

SantourA commented Mar 27, 2017 via email

@HyperBrain
Copy link
Member

Yes. Will start working on it right now 😄

@HyperBrain
Copy link
Member

I had to restructure the APIG handling first as I found a semantic flaw in there. This is fixed now and I will continue on the authorizer stuff now.

@HyperBrain
Copy link
Member

I just tried plain Serverless with this declaration:

functions:
  testfct1:
    description: 'Echo function echoes alias'
    handler: handlers/testfct1/handler.handle
    events:
      - http:
          method: GET
          path: /func1
          authorizer:
            identitySource: method.request.header.Authorization
            resultTtlInSeconds: 0
            arn: arn:aws:lambda:us-east-1:XXXXXXX:profile-access-token-auth:dev

The authorizer resource is not created in the serverless CF file.

@SantourA Did you try custom authorizers with plain Serverless? Did it create a CF resource?

@HyperBrain
Copy link
Member

Debugged the Serverless code. It seems that the name property in the authorizer is mandatory - otherwise it won't merge the resource properly.

@HyperBrain
Copy link
Member

Ran into an issue in Serverless: serverless/serverless#3413

@mgstigler
Copy link

Hi, has this been resolved? I am not using authorizers and I am still getting the policy error.

@HyperBrain
Copy link
Member

HyperBrain commented Apr 11, 2017

The fix committed to master - was an additional error in the IAM policy handling - custom authorizers still won't work, but the policy count error is gone.
I'll try to release a version soon.

@SantourA
Copy link
Author

Will you have a new build soon?

@HyperBrain
Copy link
Member

Sorry for the delay. I worked hard to get Serverless have the new event model, so unfortunately I did not spend much time on the plugin. Now I will switch back to this project and see that I can release the fixes in the upcoming week.

@HyperBrain
Copy link
Member

@SantourA Did you check if master works and resolves the issue for you? Be careful, as the APIG changes I did might need you to remove the alias stacks before deploying with the new version. Additionally I'd propose that you use it with a test project first, in case you use the new SLS 1.12.x version.

@HyperBrain
Copy link
Member

@SantourA Just released 0.4.0.

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

3 participants