-
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
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/Settings/RunCommandSettings.cs
Outdated
Show resolved
Hide resolved
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/Settings/RunCommandSettings.cs
Outdated
Show resolved
Hide resolved
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/Settings/RunCommandSettings.cs
Outdated
Show resolved
Hide resolved
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/Settings/RunCommandSettings.cs
Outdated
Show resolved
Hide resolved
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.