500 Internal Server Error When Deploying Next.js 14 App Router on Azure
Unanswered
Philippine Crocodile posted this in #help-forum
Philippine CrocodileOP
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!
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!
9 Replies
Philippine CrocodileOP
Pipeline script
name: Azure Static Web Apps CI/CD
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)Logs aren't showing much useful info.Can you still share the errors?
Philippine CrocodileOP
Sure here it is.
I have deployed this app on Azure Static Web Apps
@Philippine Crocodile Sure here it is.
Spectacled bear
Check logs on azure where the app is running.
Philippine CrocodileOP
Can you help me how to check logs?
Philippine CrocodileOP
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.
I have just deployed clean app and it is working fine.
Spectacled bear
Glad to hear. Please mark it as resolved.
@Philippine Crocodile Can you help me how to check logs?
Spectacled bear
I'm not sure about azure to check logs, but should be pretty easy. Try to find logs for the service in which you've deployed your app.