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

core: CLI --hotswap -> We don't support attributes of the 'AWS::Cognito::UserPool' resource. #28058

Open
louislatreille opened this issue Nov 17, 2023 · 1 comment
Labels
bug This issue is a bug. cli Issues related to the CDK CLI effort/medium Medium work item – several days of effort needs-review p2 package/tools Related to AWS CDK Tools or CLI

Comments

@louislatreille
Copy link

louislatreille commented Nov 17, 2023

Describe the bug

I have a stack that has a nested stack

The parent stack instantiate many resources, including a Cognito UserPool. The nested stack has only Lambda function, which use some attributes of the UserPool. When deploying and using the hotswap option, the deployment fails.

Expected Behavior

I expect the hotswap option to succeed, and successfully deploy the lambda functions in my nested stack.

Current Behavior

I get the following error:

Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: We don't support attributes of the 'AWS::Cognito::UserPool' resource. This is a CDK limitation. Please report it at https://github.com/aws/aws-cdk/issues/new/choose

Reproduction Steps

bin/index.ts

#!/usr/bin/env node
import { App } from "aws-cdk-lib";
import "source-map-support/register";
import { StackOne } from "./test";

const app = new App();

const test = new StackOne(app, "my-stack", { env: { region: "<region>", account: "<account>" } });

lib/index.ts

import { NestedStack, NestedStackProps, Stack, StackProps } from "aws-cdk-lib";
import { Construct } from "constructs";
import { UserPool, StringAttribute } from "aws-cdk-lib/aws-cognito";
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";

type Props = NestedStackProps & {
  userPoolId: string;
  userPoolArn: string;
};

export class StackTwo extends NestedStack {
  constructor(scope: Construct, id: string, props: Props) {
    super(scope, id, props);

    new NodejsFunction(this, "my-lambda", {
      entry: "./test/handler.ts",
      handler: "main",
      environment: {
        POOL_ID: props.userPoolId,
        POOL_ARN: props.userPoolArn,
      },
    });
  }
}

export class StackOne extends Stack {
  constructor(scope: Construct, id: string, props: StackProps) {
    super(scope, id, {
      ...props,
    });

    const userPool = new UserPool(this, "test-userpool", {
      userPoolName: "test-userpool",
      signInCaseSensitive: false, // case insensitive is preferred in most situations
      selfSignUpEnabled: true,
      standardAttributes: {
        preferredUsername: {
          mutable: true,
          required: true,
        },
      },
      customAttributes: {
        appUsername: new StringAttribute({ minLen: 3, maxLen: 20, mutable: true }),
      },
      signInAliases: { email: true },
      autoVerify: { email: true },
    });

    new StackTwo(this, "my-stack-two", {
      userPoolArn: userPool.userPoolArn,
      userPoolId: userPool.userPoolId,
    });
  }
}

lib/handler.ts

export const main = () => {};

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.108.1 (build 2320255)

Framework Version

No response

Node.js Version

v18.16.0

OS

Linux

Language

TypeScript

Language Version

TypeScript 4.8.4

Other information

No response

@louislatreille louislatreille added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 17, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Nov 17, 2023
@pahud
Copy link
Contributor

pahud commented Nov 21, 2023

Probably related to #25418

We'll review this issue this week.

@pahud pahud added needs-review p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 21, 2023
@pahud pahud changed the title (aws-tools): CLI --hotswap -> We don't support attributes of the 'AWS::Cognito::UserPool' resource. core: CLI --hotswap -> We don't support attributes of the 'AWS::Cognito::UserPool' resource. Nov 21, 2023
@pahud pahud added the cli Issues related to the CDK CLI label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. cli Issues related to the CDK CLI effort/medium Medium work item – several days of effort needs-review p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

2 participants