Next.js SSR app on Azure Static Web Apps throws Server Error

Jihoo Byeon 25 Reputation points
2023-12-02T13:21:47.59+00:00

I depolyed a simple Next.js SSR app to Azure Static Web Apps via Azure Pipelines. It deployed with no error, but app throws "Server Error”.

스크린샷 2023-12-02 오후 10.19.59

I didn’t installed other packages via yarn and using default Azure pipeline YAML file. The only thing which is not basic on my app is Yarn; I’m using ver 4.0.2 - so I had to use node:18. I don't use app router. I use good-ol' pages router. I tried everything I can do and nothing worked.

This is my app: https://jolly-flower-0b2849210.4.azurestaticapps.net

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,176 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-12-04T13:02:47.06+00:00

    Apologies for the delayed response from over the weekend.

    Based on the issue description, I understand you mentioned that you didn't install other packages via yarn and are using the default Azure pipeline YAML file. Also, no, app router.

    You may try the following steps to isolate the issue:

    1.    You may always leverage Azure Static Web Apps diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal.

    In the left navigation, click on Diagnose and solve problems - Review and run - “Configuration and Management” 

    -Azure Static Web Apps diagnostics overview

    2.    Kindly your app_location and output_location in the Azure pipeline YAML file are correctly set. The app_location should point to the root of your Next.js app, and the output_location should point to the .next folder after the build.

    -Configuration overview

    1. Review the Build and Deployment Logs to fetch more info.

    You may define a fallback rule by adding a navigationFallback section.
     Use staticwebapp.config.json as described in this article to configure routing and other settings for your static web app.

    -Build configuration for Azure Static Web Apps

    Kindly let us know, I'll follow-up with you further.


  2. Jihoo Byeon 25 Reputation points
    2023-12-05T03:10:07.26+00:00

    I found that downgrading to yarn classic (version 1.x) works.
    @ajkuma, please tell whom responsible to official docs to codify on Azure SWA docs that Static web apps DOES NOT SUPPORT yarn berry.


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.