Skip to content

aws-cdk-lib/aws-sagemaker: CfnApp #/AppType: CodeEditor is not a valid enum value #34223

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

Open
1 task
mikevoets opened this issue Apr 22, 2025 · 1 comment
Open
1 task
Labels
bug This issue is a bug. needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3 package/tools Related to AWS CDK Tools or CLI

Comments

@mikevoets
Copy link

Describe the bug

I noted that in the CloudFormation documentation, 'CodeEditor' is not a valid type for AppType: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-app.html#cfn-sagemaker-app-apptype. However, when I look up existing apps for my domain with AWS CLI (configured with click-ops), it does return my app with AppType 'CodeEditor'.

{
    "Apps": [
        {
            "DomainId": "d-u0oecosdfsf",
            "SpaceName": "code-editor-mike",
            "AppType": "CodeEditor",
            "AppName": "default",
            "Status": "InService",
            "CreationTime": "2025-04-22T07:24:35.004000+12:00",
            "ResourceSpec": {
                "SageMakerImageArn": "arn:aws:sagemaker:us-east-1:885854791233:image/sagemaker-distribution-cpu",
                "SageMakerImageVersionAlias": "2.4.1",
                "InstanceType": "ml.t3.medium"
            }
        }
    ]
}

When I declare this app via CDK, it throws an error.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

I expect CodeEditor to be a valid enum type, and CDK to create the app.

Current Behavior

_ToolkitError: The stack named dev-sagemaker-ai-stack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Properties validation failed for resource SagemakerCodeEditorApp with message:
[#/AppType: CodeEditor is not a valid enum value]

Reproduction Steps

Deploy the following with CDK:

const domain: CfnDomain;
const userProfile: CfnUserProfile;

new CfnApp(this, 'SagemakerCodeEditorApp', {
  appName: 'CodeEditor',
  domainId: domain.attrDomainId,
  userProfileName: userProfile.userProfileName,
  appType: 'CodeEditor',
  resourceSpec: {
    instanceType: 'ml.t3.medium',
    sageMakerImageArn: `arn:aws:sagemaker:us-east-1:885854791233:image/sagemaker-distribution-cpu`,
  },
});

Possible Solution

Add CodeEditor to possible types of the AppType enum.

Additional Information/Context

No response

CDK CLI Version

2.1007.0

Framework Version

No response

Node.js Version

v22.10.0

OS

macOS Sequioa Version 15.3.2 (24D81)

Language

TypeScript

Language Version

5.6.3

Other information

No response

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

pahud commented Apr 23, 2025

Hi @mikevoets,

Thanks for reporting this issue and providing detailed information!

You've correctly identified a discrepancy between the SageMaker service behavior (allowing AppType: 'CodeEditor', as seen via the CLI) and the current CloudFormation resource specification for AWS::SageMaker::App. The AWS CDK's CfnApp construct is generated based on this CloudFormation specification, which currently does not list 'CodeEditor' as a valid enum value for the appType property, leading to the deployment error you're experiencing.

The root cause is that the underlying CloudFormation schema needs to be updated by AWS to include 'CodeEditor' as a supported AppType. Once the CloudFormation specification is updated, the CDK L1 constructs will be regenerated in a subsequent release to include this change.

Unfortunately, there isn't a direct workaround within the CDK library itself at this moment, as the validation occurs at the CloudFormation service level based on its schema. The fix requires an update to the CloudFormation resource provider schema for AWS::SageMaker::App.

We recommend bringing this up in https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues to help cloudformation team prioritize.

While this specific issue relies on an upstream fix from the CloudFormation team, we always appreciate community contributions. If you encounter other issues or have suggestions for the CDK, feel free to open new issues or contribute with Pull Requests!

@pahud pahud added needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3 and removed needs-triage This issue or PR still needs to be triaged. labels Apr 23, 2025
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. needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

2 participants