Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
325 stars 56 forks source link

Support for `dotnet-isolated` version 8.0 for managed APIs #1394

Open paule96 opened 8 months ago

paule96 commented 8 months ago

Is your feature request related to a problem? Please describe. Dotnet 8.0 is now out for around 2 months, so it would be nice to have the support also in azure static web apps. Currently when you try to deploy an dotnet 8.0 functions project to azure static webapp you will get with the swa cli the following response:

PS /workspaces/CZ.Azure.FileExchange> swa deploy ./temp/fe/wwwroot/ --deployment-token $token --api-location ./temp/api/

Welcome to Azure Static Web Apps CLI (1.1.6)

Deploying front-end files from folder:
  /workspaces/CZ.Azure.FileExchange/temp/fe/wwwroot

Deploying API from folder:
  /workspaces/CZ.Azure.FileExchange/temp/api

Consider providing api-language and version using --api-language and --api-version flags,
    otherwise default values apiLanguage: node and apiVersion: 16 will apply

Deploying to environment: preview

WARNING: Failed to read staticwebapp.config.json configuration from:
   /workspaces/CZ.Azure.FileExchange/temp/fe/wwwroot/staticwebapp.config.json

The following error was encountered: must be equal to one of the allowed values dotnet:3.1, dotnet:6.0, dotnet-isolated:6.0, dotnet-isolated:7.0, node:12, node:14, node:16, node:18, python:3.8, python:3.9, python:3.10
0: {
1:     "platform": {
2:         "apiRuntime": "dotnet-isolated:8.0"
3:     },

Please fix the above error and try again to load and use the configuration.
Read more: https://aka.ms/swa/config-schema
Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.025241/linux/StaticSitesClient@1.0.025241
⠋ Preparing deployment. Please wait...✖ 
✖ Deployment Failed :(
✖ Deployment Failure Reason: spawn ETXTBSY
✖ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/azure/static-web-apps/

✖ If you believe this behavior is unexpected, please raise a GitHub issue at:
  https://github.com/Azure/static-web-apps-cli/issues/new/choose

When you try it manually (so directly talk to the SWA apis, that I refactored) you get no errors but the following result:

image

This is the behavior if Azure static webapps has a problem to start the functions API

Describe the solution you'd like I know that there will be some time to go to get in-process support for dotnet 8.0. But it would be nice to have already access to it for isolated installations.

What was confusing is that there is a blog post out, that claims that it should work to deploy a dotnet 8.0 isolated SWA functions API: https://techcommunity.microsoft.com/t5/apps-on-azure-blog/build-and-deploy-net-8-blazor-wasm-apps-with-serverless-apis/ba-p/3988412

A sample project to try things out can be found here: https://github.com/codez-one/CZ.Azure.FileExchange/pull/39

thomasgauvin commented 8 months ago

Thanks for bringing this to our attention, looking into it!

thomasgauvin commented 8 months ago

@paule96 thanks for reporting the bug, as a temporary workaround, deploys from a GH Actions/Azure DevOps setup should work as well, worth considering as a workaround for now while we work on the fix