Skip to content

Conversation

@lcsoft77
Copy link

@lcsoft77 lcsoft77 commented Feb 9, 2025

Adds a new environment for .NET 8 to Fission, allowing serverless functions to run with the latest .NET version.

.NET 8 provides performance and stability improvements and is the latest LTS version. This update enables users to take advantage of these enhancements with Fission.

Based on .NET 8 SDK
Updated Dockerfile to support .NET 8

@soharab-ic
Copy link
Contributor

@lcsoft77 Please make following changes:

Note: --code flag is used when we have a single file. For source code, with multiple files we should use --src flag.

$ fission function create -h
  --code=''                             URL or local path for single file source code
  --sourcearchive=[] (--source, --src)  URL or local paths for source archive
  --deployarchive=[] (--deploy)         URL or local paths for binary archive

I was not able to run HttpTriggerExample. Please let me know if my steps are correct.
These are the steps, I tried.

$ docker build -t soharab/dotnet8-env .
$ fission env create --name dotnet8 --image soharab/dotnet8-env:latest
$ zip dotnet8-ht.zip HttpTriggerExample.csproj MyFunction.cs
$ fission function create --name echo --env dotnet8 --code dotnet8-ht.zip --entrypoint HttpTriggerExample:HttpTriggerExample:MyFunction

I am seeing this error when running fission fn test:

$ fission fn test --name echo 
rror: calling function echo: 500; Please try again or fix the error: 

===================================
Function: echo
Environment: dotnet8
Namespace: default
Pod: poolmgr-dotnet8-default-1291868-65599686f7-66dxw
Container: dotnet8
Node: kind-worker
===================================
warn: Microsoft.AspNetCore.Hosting.Diagnostics[15]
     Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://*:8888'.
info: Microsoft.Hosting.Lifetime[14]
     Now listening on: http://[::]:8888
info: Microsoft.Hosting.Lifetime[0]
     Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
     Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
     Content root path: /app
info: Fission.DotNet.SpecializeController[0]
     SpecializeV2 called
info: Fission.DotNet.SpecializeController[0]
     Body: {"filepath":"/userfunc/deployarchive","functionName":"HttpTriggerExample:HttpTriggerExample:MyFunction","url":"","FunctionMetadata":{"name":"echo","namespace":"default","uid":"5c209109-9e99-4ff1-b8a9-ac50021f522b","resourceVersion":"1309009","generation":1,"creationTimestamp":"2025-02-10T09:35:50Z","managedFields":[{"manager":"fission","operation":"Update","apiVersion":"fission.io/v1","time":"2025-02-10T09:35:50Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{".":{},"f:InvokeStrategy":{".":{},"f:ExecutionStrategy":{".":{},"f:ExecutorType":{},"f:MaxScale":{},"f:MinScale":{},"f:SpecializationTimeout":{},"f:TargetCPUPercent":{}},"f:StrategyType":{}},"f:concurrency":{},"f:environment":{".":{},"f:name":{},"f:namespace":{}},"f:functionTimeout":{},"f:idletimeout":{},"f:package":{".":{},"f:functionName":{},"f:packageref":{".":{},"f:name":{},"f:namespace":{},"f:resourceversion":{}}},"f:requestsPerPod":{},"f:resources":{}}}}]},"envVersion":3}
info: Fission.DotNet.Services.SpecializeService[0]
     Deploy archive exists
info: Fission.DotNet.Services.SpecializeService[0]
     Deploy archive unzipped to /function
info: Fission.DotNet.Controllers.FunctionController[0]
     FunctionController.Run
fail: Microsoft.AspNetCore.Server.Kestrel[13]
     Connection id "0HNA9MP7NCI1S", Request id "0HNA9MP7NCI1S:00000001": An unhandled exception was thrown by the application.
     System.Exception: File /function/HttpTriggerExample.dll not found.
        at Fission.DotNet.Services.FunctionService.LoadAssembly(String assemblyPath, String nameSpace, String classFunctionName) in /src/Fission.DotNet/Services/FunctionService.cs:line 233
        at Fission.DotNet.Services.FunctionService.Load() in /src/Fission.DotNet/Services/FunctionService.cs:line 213
        at Fission.DotNet.Controllers.FunctionController.Run(HttpRequest request) in /src/Fission.DotNet/Controllers/FunctionController.cs:line 79
        at Fission.DotNet.Controllers.FunctionController.Get() in /src/Fission.DotNet/Controllers/FunctionController.cs:line 30
        at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
     --- End of stack trace from previous location ---
        at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
        at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
        at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
        at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

@lcsoft77
Copy link
Author

In the last commit I added the requested changes.
For the README part, I improved the Usage chapter that indicates how to use the net8 environment. In particular I added the passage that indicates that it is necessary to compile the sources externally, to avoid delays due to compilation in cold starts. The resulting assemblies (with all the necessary external files), will have to be compressed in a zip file.
This approach allows you to test the function externally. I currently have a mock project under development to debug the function.

@sanketsudake
Copy link
Member

@lcsoft77 While we can keep approach you have mentioned for local verification.
I think we can check if we have builder for compiling the source code and storing archive in fission.
We follow similar approach for other compiled langauges, java, Go etc.
We compile source code with builder and store package binaries with storage service. That way there wont be issue of cold start time.

@sanketsudake
Copy link
Member

Added support via #425
Please feel free to extend merged environment if you see any gaps in merged environment.

@sanketsudake
Copy link
Member

Closing this PR . Feel free to reopen if any gaps in existing merged environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants