-
Notifications
You must be signed in to change notification settings - Fork 702
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
We are looking into how we can support adding a AWS Lambda Function to the DistributedApplicationBuilder
. A Lambda function can be written as an executable or as a class library. The class library programming model being the more common approach.
The executable approach is not an issue for Aspire but for the class library we need to customize the execution arguments. Lambda functions coded as a class library are started with a host executable and the depsfile and runtimeconfig are overriden at startup. The class library is passed in as an argument to the host executable. For example if we had .NET project called "ClassLibraryLambdaFunction" that contained a Lambda function it would be executed using the following:
dotnet exec --depsfile ./ClassLibraryLambdaFunction.deps.json --runtimeconfig ./ClassLibraryLambdaFunction.runtimeconfig.json ../../../../AspireExtensions/LambdaHost/Amazon.Lambda.RuntimeSupport.dll ClassLibraryLambdaFunction::ClassLibraryLambdaFunction.Function::FunctionHandler
Having this configured in the launchSettings.json file by the user is not practical and as part of an AddAWSLambdaFunction
method I want to be able to setup all of these command line arguments for the user and return a LambdaProjectResource that is a subclass of ProjectResource.
Describe the solution you'd like
When adding project to the DistributedApplicationBuilder
you can only specify the launchSettings profile name for configuring how the project should be started. I would like to propose adding a LaunchSettingsOverrideAnnotation annotation where all of the command line arguments for the "dotnet" command can be specified. The ApplicationExecutor would look for the annotation and if exists use it for setting up the parameters for the process.
Update February 2nd, 2025
The issue has gotten long and a bit off the original ask. We currently have a work around by writing a launchsettings profile during Aspire startup that matches the arguments set in the AppHost plus other settings to launch a class library. The work around works but it feels hacky to write to the launchsettings.json file which will cause users to change files.
The ideal solution for us is to have APIs as part of Aspire that essentially defines a launch profile in memory and hand that off to either the dotnet run
or the IDE depending on whether Aspire has an IDE attached to it. I understand that is a larger task because it requires changes to the protocol for Aspire to talk to the IDE.