Skip to content

Conversation

bimnett
Copy link

@bimnett bimnett commented Sep 19, 2025

Issue #35516

Closes #35516

Reason for this change

This change addresses a feature request to add the disableExecuteApiEndpoint property to the WebSocketApi construct. This property allows users to disable the default execute-api endpoint and enforce the use of a custom domain name. The underlying CfnApi construct already supports this property, and the HttpApi construct in the same module already implements it, so this change provides consistency across API Gateway v2 constructs.

Description of changes

I've made the following code changes to expose the disableExecuteApiEndpoint property in the WebSocketApi construct:

  • Added a disableExecuteApiEndpoint?: boolean property to the WebSocketApiProps interface.
  • Added a disableExecuteApiEndpoint?: boolean property to the WebSocketApi class.
  • Passed the disableExecuteApiEndpoint property to the underlying CfnApi construct's properties.
  • Modified the public attribute apiEndpoint in the WebSocketApi class to be private.
  • Added a getter for the private _apiEndpoint property that throws a ValidationError if disableExecuteApiEndpoint is set to true. This prevents the use of a disabled endpoint.

Describe any new or updated permissions being added

None

Description of how you validated changes

I validated these changes by adding two unit tests and one integration test. The unit tests confirm that the disableExecuteApiEndpoint property is correctly set on the CloudFormation template and that the apiEndpoint getter throws an error as expected. The integration test successfully deploys a stack with the new property enabled. All tests pass.

My steps to verify:

  1. Successfully building the project with: $ npx lerna run build --skip-nx-cache.
  2. Running unit tests with: $ npx jest packages/aws-cdk-lib/aws-apigatewayv2/test/websocket/api.test.ts.
  3. Running integration test with: $ yarn integ test/aws-apigatewayv2-integrations/test/websocket/integ.disable-execute-api-endpoint.js --update-on-failed

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Sep 19, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team September 19, 2025 02:38
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Sep 19, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Features must contain a change to a README file.
❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

awsapigatewayv2: Expose disableExecuteApiEndpoint option in WebSocketApi configuration
2 participants