0

I am deploying a next app via AWS CDK using Amplify hosting. When navigating to the successfully deployed site, receive 'This .amplifyapp.com page can’t be found'. build spec is as so:

      buildSpec: codebuild.BuildSpec.fromObjectToYaml({
        // Alternatively add a `amplify.yml` to the repo
        version: '1.0',
        frontend: {
          phases: {
            preBuild: {
              commands: [
                'pwd',
                'cd frontend',
                'npm install'
              ],
            },
            build: {
              commands: [
                'pwd',
                'npm run build'
              ],
            },
          },
          artifacts: {
            baseDirectory: 'frontend/.next',
            files: [ '**/*' ],
          },
        },
      })

The next.config.js is as so:

/** @type {import('next').NextConfig} */
const nextConfig = {
  eslint: {
    ignoreDuringBuilds: true,
  },
  typescript: {
    ignoreBuildErrors: true,
  },
  images: {
    unoptimized: true,
  },
  // Ensure Next.js works from the frontend subdirectory
  distDir: '.next',
  experimental: {
    // Enable app directory features
    appDir: true,
  },
  // target: 'serverless', // Required for SSR deployment in AWS Amplify
  // reactStrictMode: true,
  // webpack(config, { isServer }) {
  //   if (isServer) {
  //     require('./scripts/generate-sitemap'); // Optional: to generate a sitemap dynamically
  //   }
  //   return config;
  // },
}

export default nextConfig

I am fairly new to SSR Next. I am not sure why navigating to the app domain does not display the app, believe there is some next configuration that is not correct for Amplify hosting perhaps.

Any insight would be great. Thank you

1
  • commented out 'target' due to deprecation... anything to add to the config for amplify>? Commented Jun 20 at 7:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.