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
330 stars 56 forks source link

Function language detection error leads to deploy failure #1206

Open Cypher1 opened 1 year ago

Cypher1 commented 1 year ago

Describe the bug

Static web app (Vite/VueJs) + Azure functions deployment fails with error (presumably from Oryx)

Error:

The function language detected is unsupported or invalid. The following languages are valid: dotnet, dotnetisolated, node, python. 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:

  1. Create a static web app using VueJs
  2. Add a Azure cloud function
  3. Generate the workflow file
  4. Upload to github actions
  5. See error in deploy log
name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - main

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LIVELY_POND_0F8C8B91E }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "api" # Api source code path - optional
          output_location: "dist" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LIVELY_POND_0F8C8B91E }}
          action: "close"

Expected behavior App should deploy with functions alongside (this previously worked, even this morning).

Note: The repository is private but I'm happy to assist by providing logs and attempting changes.

Cypher1 commented 1 year ago

Full log gist is here: https://gist.githubusercontent.com/Cypher1/f95862ccb5dce9f5324bf0038b55d938/raw/01a02c67d21ee4ecd5c1b8bbe8f074583ae4a624/Deploy.log

Cypher1 commented 1 year ago

We found a work around / awkward solution.

Setting the apiRuntime in staticwebapp.config.json is necessary, even though Oryx correctly detected the api language, and even built the code (and previous deploys worked...)

Not sure how this is possible but we have a path forward. Best of luck to anyone who finds this, it looks like Azure don't follow this issues page much.