aws / aws/aws-cdk

endpointExportName not using correct key in the outputs file

Open
#27,577 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-apigateway bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

`endpointExportName` should assign the export name for the `CfnOutput` containing the API endpoint.
It looks like that it does not put the value under the correct name in the outputs file, but rather add some random characters.

Here is a link to documentation:
[https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApi.html](url)

I'm using this code in ApiStack:
```
const api = new RestApi(this, 'Api', {
endpointExportName: 'ApiEndpoint',
});
```

### Expected Behavior

```
"ApiStack": {
"ApiEndpoint": "https://XXXXXX.amazonaws.com/prod/"
}
```

### Current Behavior

```
"ApiStack": {
"ApiEndpoint4F160690": "https://XXXXXX.amazonaws.com/prod/"
}
```

### Reproduction Steps

Run `cdk deploy --all --outputs-file outputs.json` and view the `outputs.json` file.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.101.1 (build 16ddad1)

### Framework Version

_No response_

### Node.js Version

v20.5.1

### OS

Windows

### Language

TypeScript

### Language Version

TypeScript 5.2.2

### Other information

I would like to avoid using `CfnOutput` as it seems that `endpointExportName` property is doing the same.
Could it be that I am missing some configurations in the `RestApi` initializer?

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `cdk deploy --all --outputs-file outputs.json`, then trace the `RestApi` `endpointExportName` entry point and inspect the generated `outputs.json`. Done means the API endpoint appears under `ApiEndpoint` rather than a suffixed key, without altering unrelated outputs; the payload names no source file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.