Hi @Martin Hinshelwood nkdAgility.com
I walked through a vanilla HTML and added a C# Function App project for the API. Started with .NET 6 and progress up to .NET 8 just to make sure that wasn't any issues. You really don't need to build your API separately as the Azure/static-web-apps-deploy
task will handle that for you.
There isn't I can see that is overtly wrong with your yaml. From GitHub actions snippet you shared, I don't see any publishing but that could simply outside of what you posted. I noticed you are using preview packages but I don't see being an issue. Just in case, you can try the following to see if that has any positive impact.
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.0" />
If you can hit https://your-static-webapp.azurestaticapps.ent/api/<your-endpoint> then more than like it's a portal issue where it's not detecting the function properly. However, you can't hit your API endpoint, then that leads me to believe it's deployment issue where the app code wasn't deployed as expected. In that case, I would start back with a basic Build configuration, see if that works. Then incrementally make the necessary changes as deemed fit.
EDIT 2024 Nov 18 Glad to see that your issue was resolved by setting api_skip_build
to false as part of Azure/static-web-apps-deploy
task. My thinking as to why that works, based on https://github.com/Azure/static-web-apps/issues/343, is because you're already building your API and pushing those artifacts to the resource. By telling the underlying platform to skip building it, it will use those built binaries rather than looking for the files to build the output.