Why is two userpools created? ``` | CREATE_IN_PROG...
# help
t
Why is two userpools created?
Copy code
| CREATE_IN_PROGRESS | AWS::Cognito::UserPool | AuthUserPool8115E87F | Resource creation Initiated
 | CREATE_COMPLETE | AWS::Cognito::UserPool | AuthUserPool8115E87F
 | CREATE_IN_PROGRESS | AWS::Cognito::UserPool | UserPool6BA7E5F2 | Resource creation Initiated
 | CREATE_COMPLETE | AWS::Cognito::UserPool | UserPool6BA7E5F2
My stack looks like this:
Copy code
import * as cognito from "aws-cdk-lib/aws-cognito";
import { Auth, StackContext } from "@serverless-stack/resources";

export function AuthStack({ stack }: StackContext) {
  // Userpool
  const userPool = new cognito.UserPool(stack, "UserPool", {
    selfSignUpEnabled: true,
    signInAliases: { email: true },
    signInCaseSensitive: false,
  });

  // Userpool client
  const userPoolClient = new cognito.UserPoolClient(stack, "UserPoolClient", {
    userPool,
    authFlows: { userPassword: true },
  });
  const auth = new Auth(stack, "Auth", {
    login: ["email"],
  });

  return {
    auth,
    userPool,
    userPoolClient,
  };
}
d
Looks like
Auth
creates its own pool, you can probably supply your custom pool as configuration option to it?
this seems to work for our usecase
Copy code
const auth = new Auth(stack, "Auth", {
    login: ["email"],
    cdk: {
      userPool: {
        selfSignUpEnabled: true,
        signInAliases: { email: true },
        signInCaseSensitive: false,
      },
      userPoolClient: {
        authFlows: { userPassword: true },
      },
    },
  });
f
Thanks @Danny!
@Tobias T • don’t need
signInAliases
, it’s set by
login
. • don’t need
selfSignUpEnabled
, default is
true
• don’t need
signInCaseSensitive
, default is
false
So this should work
Copy code
const auth = new Auth(stack, "Auth", {
    login: ["email"],
    cdk: {
      userPoolClient: {
        authFlows: { userPassword: true },
      },
    },
  });
t
awesome, thanks