Deploying Nextjs app to Azure Static Web App fails on build

NsSaLee 1 Reputation point


I've been following the guidelines to deploy NextJS application on azure as Static Web App, but unfortunately getting build failed on the build with "The app build failed to produce artifact folder: 'out'. Please ensure this property is configured correctly in your workflow file." error. We've tried the solutions on blogs and already asked questions, but we are not concluded for the solutions. The NextJS Apps does not have an .html page, some said that is the reason but I should not be needing to change the NextJS to SPA app.


SAP HANA on Azure Large Instances
SAP HANA on Azure Large Instances
Microsoft branding terminology for an Azure offer to run HANA instances on SAP HANA hardware deployed in Large Instance stamps in different Azure regions.
118 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,524 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
702 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Solomon metta 11 Reputation points

    I had the same issue. I eventually had to edit a portion of my package.json file from:
    "build": "next build", to "build": "next build && next export",

    2 people found this answer helpful.

  2. Jani Hyytiäinen 0 Reputation points

    Turns out, the output_location is relative to app_location.

    F.ex. if your output directory is src/out, you should have the following:

    - task: AzureStaticWebApp@0
        app_location: 'src'
        app_build_command: 'npx next build'
        output_location: 'out'
    0 comments No comments