AWS 노트

CDK가 No stack could be identified for the construct at path ... 에러를 낼 때

Jonchann 2022. 4. 7. 16:00

CDK stack을 만들 때 scope: cdk.Construct(new cdk.App())인수를 받을텐데 constructor 안에서 this가 아니라 scope를 그대로 사용했을 때 발생한다.

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

        ...
        new s3.Bucket(scope, `${env}${bucketName}`, {  // <- scope가 아니라 this
            bucketName: bucketName,
        });
        ...

    }
}