serverless-ide-vscode icon indicating copy to clipboard operation
serverless-ide-vscode copied to clipboard

Type property of authorizer has wrong valid values

Open FerroO2000 opened this issue 4 years ago • 3 comments

An error when using the authorizerId prop to refer a custom authorizer.

functions:
  func1:
    ...
    events:
      - http:
          ...
          authorizer:
            authorizerId: !Ref ApiGatewayAuthorizer
            type: CUSTOM #[Serverless IDE] Value is not accepted. Valid values: "token", "request", "cognito_user_pools".

The correct values for the type prop, when authorizerId is present, are: ONE, AWS_IAM, CUSTOM, COGNITO_USER_POOLS, AWS_CROSS_ACCOUNT_IAM, JWT

FerroO2000 avatar Sep 19 '20 16:09 FerroO2000

@FerroO2000 The way it's implemented here...

https://github.com/threadheap/serverless-ide-vscode/blob/845ca587608a0833d73f5059b4b37f4140dcb007/packages/serverless-framework-schema/json/aws/common/authorizer.json#L47-L56

.. I think we can just add all possible values for type, regardless of whether authorizerId is present or not. So you can also add TOKEN and REQUEST to the list of valid values.

faheel avatar Nov 19 '20 16:11 faheel

@FerroO2000 I was able to find the following values for type in the AWS documentation:

  • TOKEN
  • REQUEST
  • COGNITO_USER_POOLS

Could you also provide sources for the other values you mentioned?

faheel avatar Nov 19 '20 16:11 faheel

I got the values from the crash log when deploy with type prop set to TOKEN

Here is the log:

An error occurred: ApiGatewayMethodXXXVarPatch - Invalid AuthorizationType specified. Valid options are NONE,AWS_IAM,CUSTOM,COGNITO_USER_POOLS,AWS_CROSS_ACCOUNT_IAM,JWT (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException).

this happens only if an authorizer is refered with an authorizerId

FerroO2000 avatar Nov 22 '20 01:11 FerroO2000