-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(aws-apigatewayv2): apiEndpoint returns incomplete URL #16638
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-apigatewayv2Related to Amazon API Gateway v2Related to Amazon API Gateway v2bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1
Description
Get the default endpoint for this API.
Not sure if this is intentional, as the docs aren't clear.
But calling apiEndpoint on an API that has a domainName and mappingKey set will produce a wrong URL.
Reproduction Steps
const api = new HttpApi(scope, 'api', {
domainName: properties.domainName, // example.com
mappingKey: properties.mappingKey, // foo
})
new CfnOutput(this, 'url', {
value: api.apiEndpoint,
})What did you expect to happen?
To have the following resolved value:
https://example.com/foo
What actually happened?
The value resolves to the following:
https://xyz.execute-api.ap-northeast-1.amazonaws.com
Note that the domain name is not applied, and the mapping key is not present.
Environment
- CDK CLI Version : 1.123.0
- Framework Version: 1.123.0
- Node.js Version: v14.17.5
- OS : macOS
- Language (Version): TS
Other
Docs state:
https://docs.aws.amazon.com/cdk/api/latest/docs/aws-apigatewayv2-readme.html#defining-http-apis
You can retrieve the full domain URL with mapping key using the domainUrl property as so -
However, I don't have this prop on the defaultStage.
This is 🐛 Bug Report
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-apigatewayv2Related to Amazon API Gateway v2Related to Amazon API Gateway v2bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1

