Damiano Dotto
Damiano Dotto

Reputation: 129

AWS Amplify React JS Next error Source and destination must not be the same

I'm trying to deploy my Reactjs Next Application on aws amplify but it shows an error on build

This is my amplify.yml for pre-build and build:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - echo 'ANUBI PREBUILD'
        - yarn install
    build:
      commands:
        - echo 'ANUBI BUILD'
        - INVESTORTOOLBOX_CONFIGFILE=./investortoolbox-config.json
        - yarn run build
    post_build:
      commands:
        - echo 'FINISHED!'
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
  appRoot: .

On local enviroment it build and run correctly. That's the Front-end build log:

2022-01-14T21:33:33.787Z [INFO]: info  - Compiled successfully
                                 info  - Collecting page data... 2022-01-14T21:33:35.548Z [INFO]: info  - Generating static pages (0/33) 2022-01-14T21:33:35.635Z [INFO]: info  - Generating static pages (8/33) 2022-01-14T21:33:35.665Z [INFO]: info  - Generating static pages (16/33) 2022-01-14T21:33:35.688Z [INFO]: info  - Generating static pages (24/33) 2022-01-14T21:33:35.731Z [INFO]: info 
- Generating static pages (33/33) 2022-01-14T21:33:35.749Z [INFO]: info  - Finalizing page optimization... 2022-01-14T21:33:35.757Z [INFO]:  2022-01-14T21:33:35.773Z [INFO]: Page                         Size     First Load JS
                                 ┌ ● /                                      17.7 kB         290 kB
                                 ├   /_app                                  0 B            90.1 kB
                                 ├ ○ /404                                   196 B          90.3 kB
                                 ├ ● /heatmap                               2.59 kB         111 kB
                                 ├ ○ /hedgefund/[symbol]                    288 B          90.4 kB
                                 ├ ● /hedgefunds                            1.66 kB         131 kB
                                 ├ ● /news                                  2.59 kB         111 kB
                                 ├ ● /securities                            1.66 kB         131 kB
                                 ├ ● /security/[symbol]                     3.72 kB         136 kB
                                 ├   ├ /en/security/FB
                                 ├ ● /security/hedgefunds/[symbol]          4.49 kB         137 kB
                                 ├   ├ /en/security/hedgefunds/FB
                                 ├ ● /security/insiders/[symbol]            5.52 kB         278 kB
                                 ├   ├ /en/security/insiders/FB
                                 ├ λ /security/ratio/[ratio]/[symbol]       3.66 kB         133 kB
                                 └ ● /user/profile                          6.31 kB         115 kB
                                 + First Load JS shared by all              90.1 kB
                                 ├ chunks/framework-4975f770e34de116.js   42.2 kB
                                 ├ chunks/main-021d0a81dadf834e.js        27.8 kB
                                 ├ chunks/pages/_app-1b7a2c849914cce6.js  18.5 kB
                                 ├ chunks/webpack-a187f1e3bc19d705.js     1.66 kB
                                 └ css/9a77763e9d678bbb.css               25.6 kB 2022-01-14T21:33:35.774Z [INFO]: λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
                                 ○  (Static)  automatically rendered as static HTML (uses no initial props)
                                 ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps) 2022-01-14T21:33:36.430Z [INFO]: Done in 26.56s. 2022-01-14T21:33:36.434Z [INFO]: Starting SSR Build... 2022-01-14T21:35:03.566Z [ERROR]: (node:2052) UnhandledPromiseRejectionWarning: Error: Source and destination must not be the same.
                                  at /root/./-patch.2/node_modules/fs-extra/lib/util/stat.js:39:17
                                  at cb (util.js:290:31)
                                  at processTicksAndRejections (internal/process/task_queues.js:82:21)
                                  (Use `node --trace-warnings ...` to show where the warning was created) Terminating logging...

Upvotes: 0

Views: 389

Answers (1)

user14919572
user14919572

Reputation:

Can you try setting the version of NextJS to 11 or latest in your Live Packages under App Settings. Here are the instructions: enter link description here

Upvotes: 1

Related Questions