Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After deploying Next.js SSR from AWS Amplify getting 404 error #3870

Open
5 tasks done
Preethi0499 opened this issue Dec 21, 2023 · 1 comment
Open
5 tasks done

After deploying Next.js SSR from AWS Amplify getting 404 error #3870

Preethi0499 opened this issue Dec 21, 2023 · 1 comment

Comments

@Preethi0499
Copy link

Preethi0499 commented Dec 21, 2023

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

NEW_APP

AWS Region

ap-southeast-1

Amplify Hosting feature

Redirects, SSR

Frontend framework

Next.js

Next.js version

13.5.4

Next.js router

App Router

Describe the bug

My code is in specific folder . I have written the amplify.yml with specific "appRoot" directory.Even though my build and deploy get succeeded , when accessing I am getting 404 page not found

  After building and deploying this is the error 

Screenshot from 2023-12-21 13-06-41

Expected behavior

If we are specifying appRoot path it should pick up the pages from the specific path of .next, but it is not taking

Reproduction steps

Put the code in a specific path and specific the appRoot path in amplify.yml . After that build and deploy and access the url

Build Settings

This is my amplify.yml 
version: 1
appRoot: src/ui
frontend:
  phases:
    preBuild:
      commands:
        - ls
        - pwd
        - npm ci
        - ls
    build:
      commands:
        - npm run build
    postBuild:
      commands:
        - ls
        - pwd
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Log output

This staging.d3qoyhgf3tt33g.amplifyapp.com page can’t be foundNo web page was found for the web address: https://staging.d3qoyhgf3tt33g.amplifyapp.com/

Additional information

No response

@city-kim
Copy link

city-kim commented Jan 9, 2024

In my case, I used next.js in all my monorepo projects, so I included next, react, and react-dom dependencies in the package.json file in root, but not in the package.json in the apps subdirectory.

I added them back to each app's package.json and deployed it, and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants