#500 Internal Server Error When Deploying Next.js 14 App Router on Azure

10 messages · Page 1 of 1 (latest)

undone sapphire
#

Hi all,

I deployed a Next.js 14 app using the app router on Azure SWA via an Azure DevOps pipeline. The deployment completes successfully, but I’m getting a 500 Internal Server Error when accessing the app.

The app includes both Static Site Generation (SSG) and dynamic pages. Logs aren't showing much useful info.

Has anyone faced this or have any troubleshooting tips?

Thanks!

modest pelicanBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

undone sapphire
#

Pipeline script

pr:
  branches:
    include:
    - test-branch-1
trigger:
  branches:
    include:
    - test-branch-1
stages:
- stage: __default
  jobs:
  - job: build_and_deploy_job
    displayName: Build and Deploy Job
    condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
    pool:
      vmImage: ubuntu-latest
    variables:
    - group: Azure-Static-Web-Apps-calm-forest-0e249a900-variable-group
    steps:
    - task: Cache@2
      displayName: 'Cache .next/cache'
      inputs:
        key: next | $(Agent.OS) | package-lock.json
        path: '$(System.DefaultWorkingDirectory)/.next/cache'
    - task: 6d15af64-176c-496d-b583-fd2ae21d4df4@1
      inputs:
        repository: self
        submodules: true
    - task: AzureStaticWebApp@0
      inputs:
        azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_FOREST_0E249A900)
        app_location: "/"
        api_location: "api"
        output_location: ".next"
        is_static_export: false
      env:
        SANITY_API_READ_TOKEN: $(SANITY_API_READ_TOKEN)
        NEXT_PUBLIC_SANITY_DATASET: $(NEXT_PUBLIC_SANITY_DATASET)
        NEXT_PUBLIC_SANITY_PROJECT_ID: $(NEXT_PUBLIC_SANITY_PROJECT_ID)
        SMTP_HOST: $(SMTP_HOST)
        SMTP_PORT: $(SMTP_PORT)
        SMTP_USER: $(SMTP_USER)
        SMTP_PASS: $(SMTP_PASS)
        RECAPTCHA_SITE_KEY: $(RECAPTCHA_SITE_KEY)
        RECAPTCHA_SECRET_KEY: $(RECAPTCHA_SECRET_KEY)
        AIRTABLE_PERSONAL_ACCESS_TOKEN: $(AIRTABLE_PERSONAL_ACCESS_TOKEN)
        AIRTABLE_BASE_ID: $(AIRTABLE_BASE_ID)
        AIRTABLE_TABLE_NAME: $(AIRTABLE_TABLE_NAME)

half meadow
#

Logs aren't showing much useful info.
Can you still share the errors?

undone sapphire
#

Sure here it is.

#

I have deployed this app on Azure Static Web Apps

fleet pewter
undone sapphire
#

Can you help me how to check logs?

undone sapphire
#

I figured out, when I am using sanity cms embed in app getting 500 inetrnal server, else it is working fine.
I have just deployed clean app and it is working fine.

fleet pewter
#

Glad to hear. Please mark it as resolved.