You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
# Generate a name based on the stage
UserPoolName: cognito-userpool-${self:custom.myStage}
# Set email as an alias
UsernameAttributes:
- email
Policies:
PasswordPolicy:
MinimumLength: 6
RequireLowercase: False
RequireNumbers: False
RequireSymbols: False
RequireUppercase: False
CognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
# Generate an app client name based on the stage
ClientName: cognito-userpoolclient-${self:custom.myStage}
UserPoolId:
Ref: CognitoUserPool
GenerateSecret: false
ApiGatewayAuthorizer:
DependsOn:
- ApiGatewayRestApi
Type: AWS::ApiGateway::Authorizer
Properties:
Name: cognito-authorizer
IdentitySource: method.request.header.Authorization
RestApiId:
Ref: ApiGatewayRestApi
Type: COGNITO_USER_POOLS
ProviderARNs:
- Fn::GetAtt: [CognitoUserPool, Arn]
# Print out the Id of the User Pool that is created
Outputs:
UserPoolId:
Value:
Ref: CognitoUserPool
UserPoolClientId:
Value:
Ref: CognitoUserPoolClient
CognitoUserPoolArn:
Value:
Fn::GetAtt:
- CognitoUserPool
- Arn
Export:
Name: CognitoUserPoolArn-${self:custom.myStage}
and when I run sls deploy --alias my_name I get the error:
An error occurred: ApiGatewayAuthorizermy_name - Authorizer name must be unique. Authorizer cognito-authorizer already exists in this RestApi. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 79c6f96b-855e-44d1-8e96-3862bc3577bf).
The text was updated successfully, but these errors were encountered:
clethrill
changed the title
Cognito export is already exported
Authorizer name must be unique. Authorizer already exists in this RestApi
Aug 5, 2019
All the resources must be unique per stage/alias. As I can see, you've already deployed the main stage with sls deploy or sls deploy --stage your-stage, so that you have created all the resources and now you cannot deploy the copies.
Try to create unique names like:
I have a serverless.yml that looks like
cognito-resource.yml looks like
and when I run
sls deploy --alias my_name
I get the error:An error occurred: ApiGatewayAuthorizermy_name - Authorizer name must be unique. Authorizer cognito-authorizer already exists in this RestApi. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 79c6f96b-855e-44d1-8e96-3862bc3577bf).
The text was updated successfully, but these errors were encountered: