Deploy Static Webapp with Managed Function

Tom Grieme 0 Reputation points
2025-08-26T16:19:30.2133333+00:00

Hey everybody,

I want to deploy my Next.js webapp as static website to azure with one managed function. Locally everything works fine, but Azure always fails to deploy the function without any error, just saying failed to deploy. Maybe anybody here knows why. Lemme know what exactly you need or think what might be the problem. Here is my api directory structure and my github action yml:
User's image

(Instead of .Token I use my actual token name there)

name: Azure Static Web Apps CI/CD

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

env:
  AZURE_FUNCTIONS_ENVIRONMENT: Production
  WEBSITE_NODE_DEFAULT_VERSION: "~20"
  ORYX_NODE_VERSION: "20"

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@v4
        with:
          submodules: true
          lfs: false

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "22.18.0"
          cache: "npm"

      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.TOKEN}}
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          action: "upload"
          app_location: "/"
          api_location: "api"
          output_location: "out"
          skip_api_build: false
          skip_app_build: false
        env:
          IS_STATIC_EXPORT: true
          AZURE_FUNCTIONS_ENVIRONMENT: Production
          WEBSITE_NODE_DEFAULT_VERSION: "~20"
          NEXT_TELEMETRY_DISABLED: 1
          NEXT_BUILD_CACHE: "true"

  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.TOKEN}}
          action: "close"
          app_location: "."


Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
{count} votes

Accepted answer
  1. Vimal Lalani 500 Reputation points Microsoft External Staff Moderator
    2025-08-28T12:35:56.6833333+00:00

    Hi @Tom Grieme

    I would like to share a working sample for reference. This project uses the same configuration and successfully deploys a managed function with a Static Web App.

    Sample Code (GitHub): hello-static-api

    Working URL:https://labvlalani.com/

    What this sample demonstrates:

    • Proper API folder structure compatible with Static Web Apps
    • Each function in its own subfolder with function.json (HTTP trigger) and index.js

    Hopefully reviewing this working setup side by side with your project will help identify what is missing or misconfigured in your repo.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.