Skip to content
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

endpointExportName not using correct key in the outputs file #27577

Open
nirgluzman opened this issue Oct 17, 2023 · 2 comments
Open

endpointExportName not using correct key in the outputs file #27577

nirgluzman opened this issue Oct 17, 2023 · 2 comments
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@nirgluzman
Copy link

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

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?

@nirgluzman nirgluzman added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 17, 2023
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Oct 17, 2023
@pahud pahud self-assigned this Oct 17, 2023
@pahud
Copy link
Contributor

pahud commented Oct 17, 2023

image

The Output name and Export name are different. You can describe the stack and find out the real export name:

% aws cloudformation describe-stacks --stack-name demo --query 'Stacks[0].Outputs[0]'
{
    "OutputKey": "ApiEndpoint4F160690",
    "OutputValue": "https://qz8j5odwv3.execute-api.us-east-1.amazonaws.com/prod/",
    "ExportName": "MyApiEndpoint"
}

@pahud pahud added p2 effort/small Small work item – less than a day of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 17, 2023
@pahud pahud removed their assignment Oct 17, 2023
@nirgluzman
Copy link
Author

@pahud , many thanks for the prompt reply.

I confirm that I have these configs also on my side.

  1. What is the purpose of ExportName?
  2. It seems that OutputKey is the value exported to outputs.json file. How do I change the value of OutputKey in this case?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants