Next.js Discord

Discord Forum

Deploy Nextjs on Azure Static web app

Unanswered
Northern Saw-whet Owl posted this in #help-forum
Open in Discord
Northern Saw-whet OwlOP
Hello! I'm trying to deploy a Next.js (v12) app to Azure static web app via Github actions, heres the snippet
      - name: Build and copy necessary static files to standalone directory
        run: npm run deploy

      - name: Deploy
        id: swa
        uses: azure/static-web-apps-deploy@latest
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_TOKEN }}
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          action: "upload"
          app_location: "/"
          api_location: ""
          output_location: ".next/standalone/.next/server/pages"
        env:
          IS_STATIC_EXPORT: true


this is what npm run deploy does:
"deploy": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/",

and this is my next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  output: 'standalone',
  typescript: {
    tsconfigPath: './tsconfig.json',
  },
  env: {
  },
  eslint: {
    dirs: ['src', 'cypress'],
  },
};

module.exports = nextConfig;

it deploys but the static assets are not found (eg: azureUrl/_next/static/css/ab44ce7add5c3d11.css). Am I missing something?

0 Replies