Skip to content

500 error code when entering a route directly in the browser #1196

@lucasoz

Description

@lucasoz

Hi! I'm deploying my next js 13 app with app directory in azure static web apps.
When I enter to / route the app is working correctly, also when I click on a link to a /route/... for example.
When entering a route /route/... directly in the browser I am getting a next js 500 error, when I search for failures in application insights I found the following. It's happening with all the routes after index /

Message: Path doesn't exist!
Exception type: System.InvalidOperationException
Failed method: Mono.Unix.UnixFileSystemInfo.AssertValid

To Reproduce
Steps to reproduce the behavior:

  1. Deploy
  2. Go to '/...' route
  3. See 500 error
trigger:
  - develop

jobs:
  - job: build_and_deploy_job
    displayName: 'Build and Deploy Job'
    pool:
      vmImage: ubuntu-latest
    steps:
      - checkout: self
        submodules: true
      - task: AzureStaticWebApp@0
        inputs:
          app_location: '/'
          api_location: ''
          output_location: ''
          azure_static_web_apps_api_token: $(DEPLOYMENT_TOKEN)
        env:
          PRE_BUILD_COMMAND: npm install -g pnpm && pnpm install
          CUSTOM_BUILD_COMMAND: pnpm run build
          VERBOSE: true
          SITE_NAME: $(SITE_NAME)
          NEXT_PUBLIC_BACKEND_URL: $(NEXT_PUBLIC_BACKEND_URL)
          NEXT_PUBLIC_GOOGLE_CLIENT_ID: $(NEXT_PUBLIC_GOOGLE_CLIENT_ID)
        displayName: 'Deploy to Azure Static Web Apps'

image

Additional context

{
  "navigationFallback": {
    "rewrite": "/index.html"
  }
}

I have tried adding the staticwebapp.config.json with json above but it didn't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions