Azure / Azure/static-web-apps

GitHub Action is can't detect Functions runtime for pre-built API

Open
#524 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I've got a GitHub Actions pipeline building my static web app and repo, resulting in a published artifact that I'd like to take to several different places. This has a pretty standard set of static files at `/`, and then a dotnet function app at `/api`.

The contents of `/api` are the result of a `dotnet publish`, so include a `host.json` and various folders containing the functions, plus a `bin` directory with the output DLLs. All this works fine when run with `func start` locally.

When I use the build task: `Azure/static-web-apps-deploy@v1` the following warning is received in the logs:

```
[WARNING] The function language could not be detected. The language will be defaulted to node.
Function Runtime Information. OS: Linux, Functions Runtime: v3, Node version: 12.X
```

As a result, the functions fail to start, returning a "Function host is not running" message. This appears to be because the deploy task is defaulting an internal setting (maybe `FUNCTIONS_WORKER_RUNTIME`) to `node` rather than `dotnet`. In Application Insights a `Microsoft.Azure.WebJobs.Script.HostInitializationException` is received, with the message "Did not find functions with language [node]." This would be consistent with the function runtime being set incorrectly.

I'm unclear whether this is an issue with Oryx failing to detect a dotnet app (look for a bin directory?) or something else. Is there an environment variable or parameter I can pass to the `Azure/static-web-apps-deploy@v1` task to make sure it sets the runtime correctly?

**To reproduce:**
- Create a sample dotnet-based Functions app
- Using GitHub Actions, restore, build, and publish it as an artifact
- Use the artifact contents as the api directory for the `Azure/static-web-apps-deploy@v1` task
- After Oryx runs, the system fails to detect the Functions language/runtime (see Actions logs)
- Attempt to hit a function endpoint, and note the "Function host is not running" message

Build info:

``` yaml
- name: Upload Static Site
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZSTATIC }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
action: 'upload'
app_location: 'package' # App source code path
api_location: 'package/api'
skip_app_build: true
```

It would be neat to have the Functions runtime listed in the Azure Portal.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.