-
Notifications
You must be signed in to change notification settings - Fork 498
Add options to configure HTTPS ports #2282
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
base: dev
Are you sure you want to change the base?
Conversation
d9e8963 to
e6be9e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds configuration knobs for HTTPS listeners in the Lambda Test Tool (Lambda UI emulator and API Gateway emulator), primarily to support Aspire integration scenarios where certificates can be provisioned automatically.
Changes:
- Add
--lambda-emulator-https-portand--api-gateway-emulator-https-portCLI options (and corresponding env var parsing inRunCommand). - Bind the Lambda UI emulator and API Gateway emulator to HTTPS URLs when configured (and prefer HTTPS for the returned/logged
ServiceUrl). - Add an
.autoverpatch changelog entry for the TestTool package.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Processes/TestToolProcess.cs | Adds optional HTTPS URL binding for the Lambda UI emulator and prefers HTTPS for ServiceUrl. |
| Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Processes/ApiGatewayEmulatorProcess.cs | Adds optional HTTP/HTTPS URL binding for API Gateway emulator and prefers HTTPS for logging/ServiceUrl. |
| Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/Settings/RunCommandSettings.cs | Introduces new CLI options and documentation for HTTPS ports. |
| Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/RunCommand.cs | Adds env var constants/parsing and enables starting API Gateway emulator when HTTPS port is provided. |
| .autover/changes/27264eba-d94e-4190-a5ab-91c895db6b45.json | Records changelog message for the patch release. |
Comments suppressed due to low confidence (1)
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/RunCommand.cs:84
- There are existing unit tests for
RunCommand.ExecuteAsync, but none cover the new HTTPS-only API Gateway startup path (e.g.,ApiGatewayEmulatorHttpsPortset withApiGatewayEmulatorPortnull, or configuring viaAPI_GATEWAY_EMULATOR_HTTPS_PORT). Add a test to ensure the command doesn't throw and that the emulator becomes reachable when only the HTTPS port is configured (or at least that settings validation allows this configuration).
if (settings.ApiGatewayEmulatorPort.HasValue || settings.ApiGatewayEmulatorHttpsPort.HasValue)
{
if (settings.ApiGatewayEmulatorMode is null)
{
throw new ArgumentException("When --api-gateway-emulator-port or --api-gateway-emulator-https-port is set the --api-gateway-emulator-mode must be set to configure the mode for the API Gateway emulator.");
}
var apiGatewayEmulatorProcess =
ApiGatewayEmulatorProcess.Startup(settings, cancellationTokenSource.Token);
tasks.Add(apiGatewayEmulatorProcess.RunningTask);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Processes/ApiGatewayEmulatorProcess.cs
Show resolved
Hide resolved
| /// The port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode | ||
| /// also be set when setting the API Gateway emulator port. | ||
| /// </summary> | ||
| [CommandOption("--api-gateway-emulator-port <PORT>")] | ||
| [Description("The port number used for the test tool's API Gateway emulator.")] | ||
| public int? ApiGatewayEmulatorPort { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The https port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode must |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML doc for ApiGatewayEmulatorPort references the wrong option name (--api-gateway-mode) and also has a grammatical omission ("also be set"). This is user-facing documentation and should match the actual switch --api-gateway-emulator-mode and say it "must" be set.
| /// The port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode | |
| /// also be set when setting the API Gateway emulator port. | |
| /// </summary> | |
| [CommandOption("--api-gateway-emulator-port <PORT>")] | |
| [Description("The port number used for the test tool's API Gateway emulator.")] | |
| public int? ApiGatewayEmulatorPort { get; set; } | |
| /// <summary> | |
| /// The https port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode must | |
| /// The port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-emulator-mode | |
| /// must also be set when setting the API Gateway emulator port. | |
| /// </summary> | |
| [CommandOption("--api-gateway-emulator-port <PORT>")] | |
| [Description("The port number used for the test tool's API Gateway emulator.")] | |
| public int? ApiGatewayEmulatorPort { get; set; } | |
| /// <summary> | |
| /// The https port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-emulator-mode must |
| /// The port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode | ||
| /// also be set when setting the API Gateway emulator port. | ||
| /// </summary> | ||
| [CommandOption("--api-gateway-emulator-port <PORT>")] | ||
| [Description("The port number used for the test tool's API Gateway emulator.")] | ||
| public int? ApiGatewayEmulatorPort { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The https port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode must | ||
| /// also be set when setting the API Gateway emulator port. To use HTTPS the environment must be configured with certs | ||
| /// for the host specified in <see cref="LambdaEmulatorHost"/>. | ||
| /// </summary> | ||
| [CommandOption("--api-gateway-emulator-https-port <PORT>")] | ||
| [Description("The port number used for the test tool's API Gateway emulator.")] |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML doc for ApiGatewayEmulatorHttpsPort repeats the same issue as the HTTP port docs: it references --api-gateway-mode (not an actual option) and the second line talks about setting the emulator port rather than the HTTPS port. Please update the text to reference --api-gateway-emulator-mode and clarify the requirement when the HTTPS port switch is used.
| /// The port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode | |
| /// also be set when setting the API Gateway emulator port. | |
| /// </summary> | |
| [CommandOption("--api-gateway-emulator-port <PORT>")] | |
| [Description("The port number used for the test tool's API Gateway emulator.")] | |
| public int? ApiGatewayEmulatorPort { get; set; } | |
| /// <summary> | |
| /// The https port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-mode must | |
| /// also be set when setting the API Gateway emulator port. To use HTTPS the environment must be configured with certs | |
| /// for the host specified in <see cref="LambdaEmulatorHost"/>. | |
| /// </summary> | |
| [CommandOption("--api-gateway-emulator-https-port <PORT>")] | |
| [Description("The port number used for the test tool's API Gateway emulator.")] | |
| /// The port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. | |
| /// </summary> | |
| [CommandOption("--api-gateway-emulator-port <PORT>")] | |
| [Description("The port number used for the test tool's API Gateway emulator.")] | |
| public int? ApiGatewayEmulatorPort { get; set; } | |
| /// <summary> | |
| /// The HTTPS port number used for the test tool's API Gateway emulator. If a port is specified the API Gateway emulator will be started. The --api-gateway-emulator-mode option must | |
| /// be set to a mode that enables HTTPS when this HTTPS port switch is used. To use HTTPS the environment must be configured with certs | |
| /// for the host specified in <see cref="LambdaEmulatorHost"/>. | |
| /// </summary> | |
| [CommandOption("--api-gateway-emulator-https-port <PORT>")] | |
| [Description("The HTTPS port number used for the test tool's API Gateway emulator.")] |
| /// for the host specified in <see cref="LambdaEmulatorHost"/>. | ||
| /// </summary> | ||
| [CommandOption("--lambda-emulator-https-port <PORT>")] | ||
| [Description("The port number used for the test tool's web interface.")] |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Description attribute for --lambda-emulator-https-port is identical to the HTTP port description and doesn't mention HTTPS. This shows up in CLI help; please adjust it to explicitly say it configures the HTTPS endpoint / web UI HTTPS port.
| [Description("The port number used for the test tool's web interface.")] | |
| [Description("The HTTPS port number used for the test tool's web interface (web UI HTTPS endpoint).")] |
| /// for the host specified in <see cref="LambdaEmulatorHost"/>. | ||
| /// </summary> | ||
| [CommandOption("--api-gateway-emulator-https-port <PORT>")] | ||
| [Description("The port number used for the test tool's API Gateway emulator.")] |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Description attribute for --api-gateway-emulator-https-port doesn't mention HTTPS (it repeats the HTTP port text). Since this is user-facing CLI help, update it to clarify this switch configures the HTTPS listener for the API Gateway emulator.
| [Description("The port number used for the test tool's API Gateway emulator.")] | |
| [Description("The HTTPS port number used for the test tool's API Gateway emulator listener.")] |
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/RunCommand.cs
Outdated
Show resolved
Hide resolved
e6be9e7 to
03cca33
Compare
Issue #, if available:
aws/integrations-on-dotnet-aspire-for-aws#136
Description of changes:
Added the
--lambda-emulator-https-portand--api-gateway-emulator-https-portswitches to configure what HTTPS ports to listen to. Also added corresponding environment variablesLAMBDA_WEB_UI_HTTPS_PORTandAPI_GATEWAY_EMULATOR_HTTPS_PORTthat the Aspire integration will use to configure the ports.To use HTTPS the user has to make sure the environment has certs configured for the host which is usually
localhost. Aspire will automatically take care of setting up certs and set theSSL_CERT_DIRenvironment variable which ASP.NET Core will pick up and automatically use.For the Lambda emulator side the
--lambda-emulator-portstill must always be set because the Lambda Runtime API that Lambda functions call only goes over HTTP. For API Gateway you can set either--api-gateway-emulator-portor--api-gateway-emulator-https-portor both.Testing with HTTPS ports through xunit is tricky and I doubt our CI system will have certs in place so I relied on manually testing building the test tool into NuGet packages and testing it directly along with the Aspire integration.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.