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

Amplify Next JS Build and Deployment "Successful" but not visible at the domain I have linked #3838

Closed
5 tasks done
PatOfCle opened this issue Dec 4, 2023 · 15 comments
Closed
5 tasks done
Assignees
Labels
archived This issue has been locked. compute question Further information is requested

Comments

@PatOfCle
Copy link

PatOfCle commented Dec 4, 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

d27w7g8napxr00

AWS Region

us-east-2

Amplify Hosting feature

Custom build image, Custom domain, Deployments, Frontend builds, SSR

Frontend framework

Next.js

Next.js version

13/14

Next.js router

App Router

Describe the bug

I have a Next.js app that, when deploying via Amplify, says that all three stages "succeed", but when I click on the link to the page, the content is not visible. I can run the app perfectly locally, however.

I have scoured every corner of the internet, and tried every possible build image, node, and next version combination. Still zero clue what is wrong, as Amplify is telling me the build is successful. Maybe kind of symbolic link issue? Incredibly frustrated at this point; this doesn't seem to be a priority for the Amplify team, despite the immense number of clients moving onto Next.js.

Expected behavior

I expected the content to be visible at the linked url. The app was previously a React app. After a complete and successful migration to Next.js that I can run locally in version 13 and 14 without any issues, I expected to see the app running after Amplify tells me that the build and deployment phases succeeded.

Reproduction steps

  1. Push Next.js project to Repo linked to an AWS Amplify project.
  2. In amplify.yml, run npm install then npm run build (ignore everything else in build file. npm install and npm run build alone produce a "successful" build and deployment.
  3. Click linked domain to see the app's "successful" build/deploy result.

Build Settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - pwd
        - node -v
        - cd next-fidelis
        - pwd
        - node -v
        - npm install
        - npm ci
        - npx -v
        - npx next -v
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: next-fidelis/.next

Log output

# Put your logs below this line
                                 # Starting phase: preBuild
2023-12-04T22:10:33.073Z [INFO]: # Executing command: pwd
                                 /codebuild/output/src2157693477/src/Fidelis-Partners-Website
                                 # Executing command: node -v
2023-12-04T22:10:33.077Z [INFO]: v18.18.2
2023-12-04T22:10:33.078Z [INFO]: # Executing command: cd next-fidelis
2023-12-04T22:10:33.117Z [INFO]: # Executing command: pwd
                                 /codebuild/output/src2157693477/src/Fidelis-Partners-Website/next-fidelis
                                 # Executing command: node -v
2023-12-04T22:10:33.122Z [INFO]: v18.18.2
2023-12-04T22:10:33.123Z [INFO]: # Executing command: npm install
2023-12-04T22:11:00.016Z [WARNING]: npm
2023-12-04T22:11:00.019Z [WARNING]: WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
2023-12-04T22:11:00.105Z [WARNING]: npm WARN
2023-12-04T22:11:00.106Z [WARNING]: deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
2023-12-04T22:11:00.763Z [WARNING]: npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
2023-12-04T22:11:00.860Z [WARNING]: npm WARN
2023-12-04T22:11:00.861Z [WARNING]: deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
2023-12-04T22:11:00.992Z [WARNING]: npm WARN deprecated [email protected]: Use your platform's native DOMException instead
2023-12-04T22:11:01.053Z [WARNING]: npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
2023-12-04T22:11:01.211Z [WARNING]: npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
2023-12-04T22:11:01.768Z [WARNING]: npm WARN deprecated
2023-12-04T22:11:01.769Z [WARNING]: @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
2023-12-04T22:11:01.770Z [WARNING]: npm
2023-12-04T22:11:01.770Z [WARNING]: WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
2023-12-04T22:11:01.772Z [WARNING]: npm WARN deprecated
2023-12-04T22:11:01.772Z [WARNING]: @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
2023-12-04T22:11:01.817Z [WARNING]: npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
2023-12-04T22:11:03.191Z [WARNING]: npm WARN deprecated [email protected]: [email protected]
2023-12-04T22:11:04.025Z [WARNING]: npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
2023-12-04T22:11:16.264Z [INFO]: added 1760 packages, and audited 1761 packages in 32s
2023-12-04T22:11:16.268Z [INFO]: 252 packages are looking for funding
                                 run `npm fund` for details
2023-12-04T22:11:16.273Z [INFO]: 8 vulnerabilities (2 moderate, 6 high)
                                 To address all issues (including breaking changes), run:
                                 npm audit fix --force
                                 Run `npm audit` for details.
2023-12-04T22:11:16.304Z [INFO]: # Executing command: npm ci
2023-12-04T22:11:26.249Z [WARNING]: npm
2023-12-04T22:11:26.251Z [WARNING]: WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
2023-12-04T22:11:26.334Z [WARNING]: npm
2023-12-04T22:11:26.335Z [WARNING]: WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
2023-12-04T22:11:26.335Z [WARNING]: npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
2023-12-04T22:11:26.335Z [WARNING]: npm
2023-12-04T22:11:26.336Z [WARNING]: WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
2023-12-04T22:11:26.336Z [WARNING]: npm
2023-12-04T22:11:26.337Z [WARNING]: WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
2023-12-04T22:11:26.507Z [WARNING]: npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
2023-12-04T22:11:26.615Z [WARNING]: npm WARN
2023-12-04T22:11:26.616Z [WARNING]: deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
2023-12-04T22:11:26.628Z [WARNING]: npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
2023-12-04T22:11:26.866Z [WARNING]: npm WARN
2023-12-04T22:11:26.866Z [WARNING]: deprecated [email protected]: Use your platform's native DOMException instead
2023-12-04T22:11:26.910Z [WARNING]: npm WARN deprecated
2023-12-04T22:11:26.910Z [WARNING]: [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
2023-12-04T22:11:27.003Z [WARNING]: npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
2023-12-04T22:11:27.515Z [WARNING]: npm WARN deprecated
2023-12-04T22:11:27.516Z [WARNING]: [email protected]: [email protected]
2023-12-04T22:11:28.352Z [WARNING]: npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
2023-12-04T22:11:36.872Z [INFO]: added 1760 packages, and audited 1761 packages in 20s
2023-12-04T22:11:36.874Z [INFO]: 252 packages are looking for funding
                                 run `npm fund` for details
2023-12-04T22:11:36.881Z [INFO]: 8 vulnerabilities (2 moderate, 6 high)
                                 To address all issues (including breaking changes), run:
                                 npm audit fix --force
                                 Run `npm audit` for details.
2023-12-04T22:11:36.931Z [INFO]: # Executing command: npx -v
2023-12-04T22:11:37.192Z [INFO]: 9.8.1
2023-12-04T22:11:37.199Z [INFO]: # Executing command: npx next -v
2023-12-04T22:11:37.845Z [INFO]: Next.js v14.0.3
2023-12-04T22:11:37.855Z [INFO]: # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: npm run build
2023-12-04T22:11:38.204Z [INFO]: > [email protected] build
                                 > next build
2023-12-04T22:11:38.936Z [WARNING]: ⚠ Invalid next.config.js options detected:
2023-12-04T22:11:38.936Z [WARNING]: ⚠     Unrecognized key(s) in object: 'future'
                                    ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
2023-12-04T22:11:38.939Z [INFO]: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2023-12-04T22:11:38.952Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
                                 This information is used to shape Next.js' roadmap and prioritize features.
2023-12-04T22:11:38.953Z [INFO]: 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-12-04T22:11:39.045Z [INFO]: ▲ Next.js 14.0.3
2023-12-04T22:11:39.045Z [INFO]: Creating an optimized production build ...
2023-12-04T22:11:41.311Z [WARNING]: ⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
                                    Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
2023-12-04T22:11:50.501Z [INFO]: ✓ Compiled successfully
2023-12-04T22:11:50.502Z [INFO]: Linting and checking validity of types ...
2023-12-04T22:11:50.649Z [INFO]: Collecting page data ...
2023-12-04T22:11:52.055Z [INFO]: Generating static pages (0/12) ...
2023-12-04T22:11:52.362Z [INFO]: Generating static pages (3/12)
2023-12-04T22:11:52.456Z [INFO]: Generating static pages (6/12)
2023-12-04T22:11:52.542Z [INFO]: Generating static pages (9/12)
2023-12-04T22:11:52.604Z [INFO]: ✓ Generating static pages (12/12)
2023-12-04T22:11:53.227Z [INFO]: Finalizing page optimization ...
2023-12-04T22:11:53.228Z [INFO]: Collecting build traces ...
2023-12-04T22:11:59.650Z [INFO]: 
2023-12-04T22:11:59.654Z [INFO]: Route (app)                              Size     First Load JS
                                 ┌ ○ /                                    15.9 kB         119 kB
                                 ├ ○ /_not-found                          876 B            85 kB
                                 ├ ○ /about                               137 B          84.3 kB
                                 ├ ○ /about/history                       1.63 kB        97.8 kB
                                 ├ ○ /about/team                          3.81 kB         100 kB
                                 ├ ○ /about/values                        1.65 kB        97.8 kB
                                 ├ ○ /blog                                762 B           116 kB
                                 ├ λ /blog/[slug]                         6.89 kB         122 kB
                                 ├ ○ /contact/book-introduction           996 B          85.1 kB
                                 ├ ○ /icon.ico                            0 B                0 B
                                 └ ○ /solutions/sv-erp                    2 kB           98.2 kB
                                 + First Load JS shared by all            84.2 kB
                                 ├ chunks/472-192f38ed09d5eb2e.js       28.7 kB
                                 ├ chunks/fd9d1056-debaaf5ca7b80f22.js  53.3 kB
                                 ├ chunks/main-app-1882864e5f3d0736.js  219 B
                                 └ chunks/webpack-737b11cb1da87ba1.js   1.93 kB
                                 ○  (Static)   prerendered as static content
                                 λ  (Dynamic)  server-rendered on demand using Node.js
2023-12-04T22:11:59.707Z [INFO]: # Completed phase: build
2023-12-04T22:11:59.717Z [INFO]: ## Build completed successfully
2023-12-04T22:11:59.718Z [INFO]: # Starting caching...
2023-12-04T22:11:59.729Z [INFO]: # Creating cache artifact...
2023-12-04T22:11:59.733Z [INFO]: # Created cache artifact
2023-12-04T22:11:59.733Z [INFO]: # Uploading cache artifact...
2023-12-04T22:11:59.815Z [INFO]: # Uploaded cache artifact
2023-12-04T22:11:59.815Z [INFO]: # Caching completed
2023-12-04T22:11:59.819Z [INFO]: # No custom headers found.
2023-12-04T22:11:59.838Z [INFO]: # Starting build artifact upload process...
2023-12-04T22:12:02.226Z [INFO]: # Uploading build artifact '__artifactsHash.zip'...
2023-12-04T22:12:02.282Z [INFO]: # Uploading build artifact '__artifacts.zip'...
2023-12-04T22:12:02.648Z [INFO]: # Build artifact upload completed
2023-12-04T22:12:02.649Z [INFO]: # Starting environment caching...
2023-12-04T22:12:02.649Z [INFO]: # Uploading environment cache artifact...
2023-12-04T22:12:02.727Z [INFO]: # Uploaded environment cache artifact
2023-12-04T22:12:02.810Z [INFO]: # Environment caching completed
Terminating logging...

Additional information

Screenshot 2023-12-03 at 6 42 42 AM

I've consulted every AWS Amplify Next JS (version 13 and 14) resource on the internet and under the sun, to no avail. We are now at Build #58.
If Amplify simply can't or won't be solving this or the necessary Next.js incompatiabilities in the near future, please just tell me and I will take my business to Vercel.

Thank you for your time and help!

@PatOfCle PatOfCle changed the title Amplify Build and Deployment "Successful" but not visible at the domain I have linked Amplify Next JS Build and Deployment "Successful" but not visible at the domain I have linked Dec 4, 2023
@PatOfCle
Copy link
Author

PatOfCle commented Dec 5, 2023

If the "solution" is just me switching hosting to Vercel, please just say the word.
I'd rather stay on Amplify, but resolving these deployment errors just doesn't seem to be a priority for the Amplify team.

@ferdingler
Copy link
Contributor

ferdingler commented Dec 5, 2023

The right place to start troubleshooting this issue is by looking at your SSR logs. If you go to CloudWatch > Logs, you will find a Log Group named /aws/amplify/{appId}. Inside, you will find your execution logs. You can also access these logs via the Amplify Console:

Screenshot 2023-12-05 at 12 14 46 PM

@ferdingler
Copy link
Contributor

ferdingler commented Dec 5, 2023

It looks like you manage to find the root cause as I see your App loading properly d27w7g8napxr00, is that accurate?

@ferdingler ferdingler added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 5, 2023
@PatOfCle
Copy link
Author

PatOfCle commented Dec 5, 2023

It looks like you manage to find the root cause as I see your App loading properly d27w7g8napxr00, is that accurate?

I wish, but unfortunately no. I have a react app folder and a Next.js folder. I have fallen back on the working React App and deployed that since the Next.js project is not working when "successfully deployed".

@PatOfCle
Copy link
Author

PatOfCle commented Dec 5, 2023

Also, for some reason under the "Monitoring" section I only see the first 3 tab options: Metrics, Alarms, and Access Logs, but not Hosting Compute Logs

Screenshot 2023-12-05 at 3 17 58 PM

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 5, 2023
@Jay2113
Copy link
Contributor

Jay2113 commented Dec 6, 2023

Hi @PatOfCle, sorry to hear that you are running into issues when deploying your Next.js based app on Amplify Hosting.

Current scenario:
Since you have moved back to using the React based app, your content seems to be resolving as expected for the app d27w7g8napxr00.

Findings:

  • Based on your current app configuration, the platform attribute is set to Web i.e. a static app.
  • The build 58 logs reveal that the baseDirectory attribute is set to baseDirectory: next-fidelis/.next and the .next directory is expected in case of a Next,js SSR app.
  • To give you some context, we auto detect an app's platform attribute during app creation as either Web (Static) or Web_Compute (Dynamic) app.
  • I believe the issue occurred since you started off this app as a React or Web based app and then migrated it to a Next.js based SSR app i.e. Web_Compute.
  • Also, you are unable to view the Hosting Compute Logs as they are applicable only to Web_Compute apps.

Next steps:
We would like to understand if your Next.js app is designed to be SSR? If yes, you can add SSR functionality to the app by referring to this guide: https://docs.aws.amazon.com/amplify/latest/userguide/redeploy-ssg-to-ssr.html. Essentially, you will need to complete the following:

Please let us know if this helps resolve your issue. Thanks!

@Jay2113 Jay2113 self-assigned this Dec 6, 2023
@Jay2113 Jay2113 added question Further information is requested compute response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed pending-triage labels Dec 6, 2023
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Dec 10, 2023
@PatOfCle
Copy link
Author

Leaving comment to keep issue open: will address this shortly. @Jay2113 Thank you for the response; I'll be taking those steps and getting back to everyone soon!

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Dec 11, 2023
@OperationalFallacy
Copy link

Same problem with deployments. A mono-repo, api and website in own folders. Basic next.js, SSR

build

version: 1
applications:
  - appRoot: cof-api
    buildpath: /
    backend:
      phases:
        install:
          commands:
            - cd ..
            - pwd
            - node --version
            - nvm use 18
            - nvm use 18.17.0 || true
            - node --version
            - yarn global add tsc-alias typescript tsc
        build:
          commands:
            - yarn install --production
            - amplify --version
            # - cat $(which amplifyPush) || true
            # - amplifyPush --simple
    frontend:
      phases:
        build:
          commands:
            - pwd
            - cd ../cof-website
            - pwd
            - yarn global add tsc-alias typescript tsc
            - node --version
            - yarn install
            - yarn build
            - ls -al .next || true
            - cat .next/build-manifest.json
      artifacts:
        baseDirectory: .next
        files:
          - '**/*'
      cache:
        paths:
          - node_modules/**/*

In the logs it's uploading something... somewhere...

2023-12-30T20:57:03.371Z [INFO]: # Executing command: ls -al .next || true
2023-12-30T20:57:03.372Z [INFO]: total 1160
                                 drwxr-xr-x 5 amplify amplify    4096 Dec 30 20:56 .
                                 drwxr-xr-x 9 amplify amplify    4096 Dec 30 20:56 ..
                                 -rw-r--r-- 1 amplify amplify      21 Dec 30 20:56 BUILD_ID
                                 -rw-r--r-- 1 amplify amplify    2594 Dec 30 20:56 build-manifest.json
                                 drwxr-xr-x 5 amplify amplify      85 Dec 30 20:56 cache
                                 -rw-r--r-- 1 amplify amplify      94 Dec 30 20:56 export-marker.json
                                 -rw-r--r-- 1 amplify amplify     510 Dec 30 20:56 images-manifest.json
                                 -rw-r--r-- 1 amplify amplify    3939 Dec 30 20:56 next-minimal-server.js.nft.json
                                 -rw-r--r-- 1 amplify amplify   26718 Dec 30 20:56 next-server.js.nft.json
                                 -rw-r--r-- 1 amplify amplify      20 Dec 30 20:56 package.json
                                 -rw-r--r-- 1 amplify amplify     362 Dec 30 20:56 prerender-manifest.js
                                 -rw-r--r-- 1 amplify amplify     312 Dec 30 20:56 prerender-manifest.json
                                 -rw-r--r-- 1 amplify amplify       2 Dec 30 20:56 react-loadable-manifest.json
                                 -rw-r--r-- 1 amplify amplify    4336 Dec 30 20:56 required-server-files.json
                                 -rw-r--r-- 1 amplify amplify    1153 Dec 30 20:56 routes-manifest.json
                                 drwxr-xr-x 4 amplify amplify     285 Dec 30 20:56 server
                                 drwxr-xr-x 6 amplify amplify      73 Dec 30 20:56 static
                                 -rw-r--r-- 1 amplify amplify 1099434 Dec 30 20:56 trace
2023-12-30T20:57:03.372Z [INFO]: # Completed phase: build
2023-12-30T20:57:03.408Z [INFO]: ## Build completed successfully
2023-12-30T20:57:03.409Z [INFO]: # Starting caching...
2023-12-30T20:57:03.420Z [INFO]: # Creating cache artifact...
2023-12-30T20:57:03.424Z [INFO]: # Created cache artifact
2023-12-30T20:57:03.424Z [INFO]: # Uploading cache artifact...
2023-12-30T20:57:03.559Z [INFO]: # Uploaded cache artifact
2023-12-30T20:57:03.559Z [INFO]: # Caching completed
2023-12-30T20:57:03.581Z [INFO]: # Starting build artifact upload process...
2023-12-30T20:57:05.415Z [INFO]: # Uploading build artifact '__artifacts.zip'...
2023-12-30T20:57:05.440Z [INFO]: # Uploading build artifact '__artifactsHash.zip'...
2023-12-30T20:57:05.727Z [INFO]: # Build artifact upload completed
2023-12-30T20:57:05.728Z [INFO]: # Starting environment caching...
2023-12-30T20:57:05.728Z [INFO]: # Uploading environment cache artifact...
2023-12-30T20:57:05.840Z [INFO]: # Uploaded environment cache artifact
2023-12-30T20:57:05.840Z [INFO]: # Environment caching completed

next.config.js

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  images: {
    unoptimized: true,
  },
};

module.exports = nextConfig;

And then website is 404

And when I connected branch to Vercel, it built it and deployed from the first attempt 🤷

@talalanjum
Copy link

talalanjum commented Jan 2, 2024

Having sort of the same issue, app runs perfectly locally using dev and using build, but after deploying to amplify it shows the not found page on every route. the header and footer do show up, but every route renders the not found component for some reason. All deployment stages on amplify are running fine, and the cloudwatch logs don't show any errors as well. The app platform is set as web_compute as well. @PatOfCle please let me know if you found a solution to your problem

@OperationalFallacy
Copy link

I've ended up swapping appRoot with front-end

version: 1
applications:
  - appRoot: cof-website <<- appRoot of front-end, otherwise it messes up artifacts in the next app type (frontend)
    backend:
      phases:
        install:
          commands:
            - pwd
            - cd ../cof-api
            - node --version
            - nvm use 18.17.0 || true
            - yarn global add tsc-alias typescript tsc
        build:
          commands:
            - yarn install --production
            - amplify --version
            - cat $(which amplifyPush) || true
            - amplifyPush --simple
    frontend:
      phases:
        build:
          commands:
            - pwd
            - cd ../cof-website
      artifacts:
        baseDirectory: out 
        files:
          - '**/*'

If anybody from Amplify team on this thread, the problem here is lack of insight into produced artifacts. Vercel for example has special page to examine the artifact.

Maybe there is a way to print this information using some kind of post build phase, idk.

@hanna-becker
Copy link

hanna-becker commented Feb 20, 2024

I ran into the same issue with my Angular app after being forced to migrate to the Amazon Linux:2023 image because we need to use node 18.8.2 now (see this comment). So far, no resolution for me.

@Jay2113
Copy link
Contributor

Jay2113 commented Mar 1, 2024

@OperationalFallacy 👋 , we have updated our documentation with the following troubleshooting guide: https://docs.aws.amazon.com/amplify/latest/userguide/troubleshooting-ssr-deployment.html#build-output-too-large. This guide should enable you to:

  • Download and inspect your build artifacts
  • Analyze the .next directory and the build cache directory within it
  • Measure the size of your compute and static directories
  • Review the dependencies within the node_modules folder
  • Delete the binaries that aren't required at runtime

Additionally, to improve build performance and to persist the cache between builds Amplify Hosting now adds the following cache paths by default to your buildSpec:

cache:
  paths:
    - node_modules/**/* # Cache `node_modules` for faster `yarn` or `npm i`
    - .next/cache/**/* # Cache Next.js for faster application rebuilds

@talalanjum @hanna-becker If you are observing errors such as content not loading or routes not rendering for your Next.js based SSR apps, I'll recommend taking a look at the hosting compute runtime logs as stated here.

@Jay2113 Jay2113 closed this as completed Mar 1, 2024
Copy link

github-actions bot commented Mar 1, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked.

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

No branches or pull requests

6 participants