aws / aws/aws-cdk

glue: CfnDatabase can't update if name is not provided

Open
#31,158 3 comments 8 reactions 0 assignees View on GitHub
@aws-cdk/aws-glue bug needs-cfn p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

When once Cretes instance of `CfnDatabase` without name property set, it has name generated automatically based on construct ID. This is expected behaviour. But when construct is updated, CloudFormation errors with "no name provided error"

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

2.152

### Expected Behavior

When `CfnDatabase` is updated without name property set up, it would use previously generated database name

### Current Behavior

When `CfnDatabase` is updated without name property set up it errors with:
Database name cannot be equal to null or empty (Service: AWSGlue; Status Code: 400; Error Code: InvalidInputException; Request ID:00000000-0000-4000-0000-000000000000; Proxy: null)

### Reproduction Steps

Create Database construct:
```
const glueDatabase = new CfnDatabase(this, "MyDatabase", {
catalogId: this.account,
databaseInput: {
description: "My Database",
},
});
```
deploy, update code to:
```
const glueDatabase = new CfnDatabase(this, "MyDatabase", {
catalogId: this.account,
databaseInput: {
description: "My Database",
locationUri: `s3://${bucket.bucketName}/path/`,
},
});
```
and deploy once again

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.152.0 (build faa7d79)

### Framework Version

_No response_

### Node.js Version

v18.12.1

### OS

MacOs 14.6

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the CfnDatabase TypeScript reproduction: deploy it without a name, add locationUri, and deploy again to observe the CloudFormation update failure. Trace how the previously generated database name is handled during the update; done means the second deployment succeeds while retaining that generated name.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.