Deploying Nextjs app to Azure Static Web App fails on build

NsSaLee 1 Reputation point
2021-12-17T07:28:52.663+00:00

Hi,

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.

158469-azure.txt

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.
123 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,978 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
993 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Solomon metta 11 Reputation points
    2022-08-12T15:56:15.757+00:00

    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 5 Reputation points
    2023-01-18T01:37:26.5966667+00:00

    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
      inputs:
        app_location: 'src'
        app_build_command: 'npx next build'
        output_location: 'out'
    
    1 person found this answer 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.