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

MonoRepo NextJS SSR build hangs on Generating static pages (0/4) #3469

Closed
5 tasks done
alycda opened this issue May 9, 2023 · 4 comments
Closed
5 tasks done

MonoRepo NextJS SSR build hangs on Generating static pages (0/4) #3469

alycda opened this issue May 9, 2023 · 4 comments
Labels
archived This issue has been locked. monorepo pending-triage question Further information is requested

Comments

@alycda
Copy link

alycda commented May 9, 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

d3hlmgrziazvps

AWS Region

us-west-2

Amplify Hosting feature

Frontend builds, Monorepo, SSR

Describe the bug

Following the steps here: https://medium.com/@writetochrispalmer/how-to-deploy-a-monorepo-next-js-13-app-to-aws-amplify-1700f0a17653 I created a similar monorepo: https://github.com/alycda/nextjs-amplify and connected to AWS Amplify.

Frontend Build hangs: (even when increasing timeout to max length)

Expected behavior

Build should complete all steps as seen in local environment: (run from GitHub Codespaces in VS Code)

$ yarn workspace client build
yarn workspace v1.22.19
yarn run v1.22.19
$ next build --debug
info  - Creating an optimized production build  
info  - Compiled successfully
info  - Linting and checking validity of types  
info  - Collecting page data  
info  - Generating static pages (4/4)
info  - Finalizing page optimization  

Route (app)                                Size     First Load JS
┌ ○ /                                      4.93 kB        81.8 kB
└ ○ /favicon.ico                           0 B                0 B
+ First Load JS shared by all              76.8 kB
  ├ chunks/7fd0f9f1-762a07e45b12abd7.js    50.5 kB
  ├ chunks/9-5c302a692c873de1.js           24.4 kB
  ├ chunks/main-app-56f6fc77559b64f5.js    211 B
  └ chunks/webpack-1de4b51dd62ec705.js     1.68 kB

Route (pages)                              Size     First Load JS
─ ○ /404                                   178 B          83.1 kB
+ First Load JS shared by all              82.9 kB
  ├ chunks/main-de0e748203dae2dd.js        81 kB
  ├ chunks/pages/_app-415a5670032b79f5.js  190 B
  └ chunks/webpack-1de4b51dd62ec705.js     1.68 kB

○  (Static)  automatically rendered as static HTML (uses no initial props)

Redirects

┌ source: /:path+/
├ destination: /:path+
└ permanent: true
 

Done in 13.67s.
Done in 13.93s.

Reproduction steps

  1. follow https://medium.com/@writetochrispalmer/how-to-deploy-a-monorepo-next-js-13-app-to-aws-amplify-1700f0a17653
  1. Environment Variables
  • AMPLIFY_DIFF_DEPLOY = false
  • AMPLIFY_MONOREPO_APP_ROOT = packages/client
  • _BUILD_TIMEOUT = 480
  • _CUSTOM_IMAGE = public.ecr.aws/u8r8k5s9/aws-amplify-next:latest
  • _LIVE_UPDATES = [{"pkg":"next-version","type":"internal","version":"latest"}]
  1. Build image settings
  • Using custom image: public.ecr.aws/u8r8k5s9/aws-amplify-next:latest
  • Build timeout: 480m
  • Live package updates: Next.js version - latest
  1. Trigger a build
  2. Observe timeout

Build Settings

version: 1
applications:
  - appRoot: packages/client
    frontend:
      phases:
        preBuild:
          commands:
            - node --version
            - export NODE_OPTIONS=--max-old-space-size=8192
            - npm install --location=global yarn
            - cd ../../
            - yarn install --frozen-lockfile --production
            - cd packages/client
            - yarn install --frozen-lockfile
            - yarn build
        build:
          commands:
            - yarn next start
      artifacts:
        baseDirectory: .next
        files:
          - '**/*'
      cache:
        paths:
          - 'node_modules/**/*'
          - '.next/cache/**/*'


### Log output

<details>

Starting phase: preBuild

Executing command: node --version

v16.16.0

Executing command: export NODE_OPTIONS=--max-old-space-size=8192

Executing command: npm install --location=global yarn

2023-05-09T05:23:04.963Z [INFO]: added 1 package, and audited 2 packages in 390ms
2023-05-09T05:23:04.965Z [INFO]: found 0 vulnerabilities
2023-05-09T05:23:04.969Z [INFO]: # Executing command: cd ../../
2023-05-09T05:23:04.969Z [INFO]: # Executing command: yarn install --frozen-lockfile --production
2023-05-09T05:23:05.224Z [INFO]: yarn install v1.22.19
2023-05-09T05:23:05.303Z [INFO]: [1/4] Resolving packages...
2023-05-09T05:23:05.499Z [INFO]: [2/4] Fetching packages...
2023-05-09T05:23:20.847Z [INFO]: [3/4] Linking dependencies...
2023-05-09T05:23:24.120Z [INFO]: [4/4] Building fresh packages...
2023-05-09T05:23:32.582Z [INFO]: Done in 27.36s.
2023-05-09T05:23:32.601Z [INFO]: # Executing command: cd packages/client
2023-05-09T05:23:32.601Z [INFO]: # Executing command: yarn install --frozen-lockfile
2023-05-09T05:23:32.748Z [INFO]: yarn install v1.22.19
2023-05-09T05:23:32.839Z [INFO]: [1/4] Resolving packages...
2023-05-09T05:23:33.047Z [INFO]: [2/4] Fetching packages...
2023-05-09T05:23:33.300Z [INFO]: [3/4] Linking dependencies...
2023-05-09T05:23:34.755Z [INFO]: [4/4] Building fresh packages...
2023-05-09T05:23:34.773Z [INFO]: Done in 2.03s.
2023-05-09T05:23:34.808Z [INFO]: # Executing command: yarn build
2023-05-09T05:23:34.952Z [INFO]: yarn run v1.22.19
2023-05-09T05:23:34.977Z [INFO]: $ next build --debug
2023-05-09T05:23:35.445Z [INFO]: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2023-05-09T05:23:35.461Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-05-09T05:23:35.461Z [INFO]: This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
2023-05-09T05:23:35.549Z [INFO]: info - Creating an optimized production build...
2023-05-09T05:23:43.230Z [INFO]: info - Compiled successfully
2023-05-09T05:23:43.232Z [INFO]: info - Linting and checking validity of types...
2023-05-09T05:23:46.031Z [INFO]: info - Collecting page data...
2023-05-09T05:23:57.968Z [INFO]: info - Generating static pages (0/4)


</details>


### Additional information

Originally the NextJS app was created with the unsupported feature of `Next.js 13 app directory (beta)` but I removed that from the config.
@alycda alycda added bug Something isn't working pending-triage labels May 9, 2023
@Matiduraan
Copy link

Same issue here

@ghost ghost added question Further information is requested monorepo and removed bug Something isn't working labels May 20, 2023
@victorccccc
Copy link
Contributor

Hi, Thanks for reporting the issue. Can you please remove yarn next start from build command which starts the next server and blocks the process? Instead, you can put yarn build in build section

Feel free to reopen if the issue persists

Thanks

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the archived This issue has been locked. label May 23, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. monorepo pending-triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants