Closed philvessey closed 1 year ago
@philvessey can you please check if you're providing apiRuntime
in staticwebapp.config.json
. If so, it should be set to dotnet-isolated:7.0
. More details at https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#selecting-the-api-language-runtime-version
If not, please check if you're creating the function app project as an isolated worker process project. More details at : https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#net-isolated-worker-process-project A sample dotnet7 isolated app csproj: https://github.com/vivekjilla/blazor-sample/blob/main/ApiIsolated/ApiIsolated.csproj
It needs to be isolated for net 7.0 with static web apps? I ask as a standard functions app on azure is working fine on net7.0 which isn't isolated.
https://github.com/Azure/static-web-apps/issues/974 this issue suggests coming soon - guessing not supported yet.
@philvessey can you provide any sample projects of your function app running on .NET 7 in-process? My understanding from these Azure Functions docs is that .NET 7 is only supported as an isolated process, though perhaps that isn't made clear when creating a Function App. https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library?tabs=v2%2Ccmd#supported-versions, https://azure.microsoft.com/en-ca/updates/generally-available-functions-now-supports-net-7-in-an-isolated-worker-process/
Regarding whether SWA supports .NET 7, we announced that the support for .NET 7 is GA here https://azure.microsoft.com/en-us/updates/generally-available-azure-static-web-apps-now-fully-supports-net-7/
It sounds like I need to go to isolated so i'm in the process of updating my code to that - will report back if I have any further issues but I have quite a few functions to update so it may be a few days.
Working fine with isolated so ill close.
Glad to hear @philvessey, thanks for the feedback, we're working on improving our getting started docs for .NET 7 as well
I updated .net6 to .net7 in azure function project i got this error in github pipeline
I updated .net6 to .net7 in azure function project i got this error in github pipeline
See above - your functions need to run in dotnet-isolated mode - will work fine once converted.
@philvessey
I already set "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
in local.settings.json file still it's not working
As referenced there are multiple steps needed. New nuget packages, a program.cs file and likely signature changes to your functions to use the new packages. See https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#net-isolated-worker-process-project
Also if you look at the API project here https://github.com/staticwebdev/blazor-starter you will see what a basic isolated API looks like and you can go from there 👍
@philvessey
I did all the step but still i am getting the same error, do i need to change anything in azure server?
No changes needed on the server - do you have your project up anywhere to have a look at?
I changed this to .NET 7 and dotnet-isolated
and was able to get the Azure Pipelines task to recognize and push it, but then Azure wouldn't let the function run. Getting 500 errors.
500 server error is what you will get if there is an error in your functions code. Suggest wrapping everything in a try catch and outputting errors that way to narrow things down as that is what I did.
@philvessey I did, this is the error I get:
Did not find functions with language [dotnet-isolated].
Microsoft.Azure.WebJobs.Script.Utility.VerifyFunctionsMatchSpecifiedLanguage
That looks like the old nugget packages - did you update to the Microsoft.Azure.Functions.Worker packages in csproj ?
@philvessey yes, I only have the two the v3 -> v4 migration article mentioned. It's kind of hard to debug the function with the static web app layer on top.
Can you show some code or got the repo online?
@philvessey I ended up getting this to work by recreating the function from the .NET 7 template -- I must've missed something somewhere in converting over the function, possibly the routing attribute value.
Describe the bug
Deploying throws the following error for the functions: The function language version detected is unsupported or invalid. The following dotnet language versions are valid: 3.1, 6.0. If you are not using Azure Functions, you can skip this check by removing the 'api_location' input from the workflow file.
A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior net7.0 should be supported for static web apps - it is for standard function apps.