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

Nextjs Turbo Monorepo 500 Error #3179

Closed
5 tasks done
Rafcin opened this issue Dec 5, 2022 · 73 comments
Closed
5 tasks done

Nextjs Turbo Monorepo 500 Error #3179

Rafcin opened this issue Dec 5, 2022 · 73 comments
Labels
archived This issue has been locked. bug Something isn't working compute investigating monorepo

Comments

@Rafcin
Copy link

Rafcin commented Dec 5, 2022

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

d2t18tt2z5krry

AWS Region

ca-central-1

Amplify Hosting feature

Build settings, Deployments, Frontend builds, Monorepo

Describe the bug

Howdy, I've discovered a bug with the new build system I had previously not thought to test. One of my main projects uses a monorepo structure. After some tinkering and dealing with the nightmare of a package manager known as pnpm, I seem unable to deploy the app; however, it builds correctly, and I can't trace the issue. The app builds correctly, finishes caching, and does all its post-build steps; it finds the correct .next folder, and then when I check the amplify domain, I get thrown a 500 error.

Expected behavior

I should be able to see my app working just fine; I think this could be the next standalone issue, although I'm wildly unsure.

Reproduction steps

I don't have a demo that can be used yet; I need to spin up a separate barebones version of my repo for this. However, my structure follows the Amplify-UI repo structure and rollup config almost the same way. The main difference is I have an apps folder, and all my apps locally reference the packages and not from npm because they aren't published. I also use hoist and auto peers shamefully...

If the Amplify team needs access to the repo, mention me, and I'll send you an invite over git.

Build Settings

Here is the Amplify YML config, you can ignore the `apps/main` section, that's old. `apps/help` is the new config.
  
  version: 1
  applications:
    - appRoot: apps/main
      env:
      variables:
        #AMPLIFY_DIFF_DEPLOY: true
      backend:
        phases:
          build:
            commands:
              - echo BACKEND MAIN BUILD
              - amplifyPush --simple
      frontend:
        phases:
          preBuild:
            commands:
              - echo FRONTEND MAIN PREBUILD
              # - node -e
              # - 'console.log(v8.getHeapStatistics().total_available_size/(1024*1024))'
              # Step out
              - cd ../../
              # We don't need to move folders, we already moved out to the root at the backend build step.
              #- nvm install 18
              - npx pnpm install
          build:
            commands:
              - echo FRONTEND MAIN BUILD
              # - aws s3 cp amplify.yml s3://main-sandbox/public/
              # - yarn amplify:clean:current-backend
              - npx pnpm run main:build
              # Step in
              - cd apps/main
          postBuild:
            commands:
              - echo END OF HELP BUILD
        artifacts:
          baseDirectory: .next
          files:
            - "**/*"
        cache:
          paths:
            - node_modules/**/*
            #- '!node_modules/.cache'
            #- '!.next/**/*'
    - appRoot: apps/help
      env:
      variables:
        #AMPLIFY_DIFF_DEPLOY: true
      backend:
        phases:
          build:
            commands:
              - echo NO BACKEND BUILD
      frontend:
        phases:
          preBuild:
            commands:
              - echo FRONTEND HELP PREBUILD
              - cd ../../
              - nvm install 16.13 # NodeJS 16.13+ is the latest version that Amplify Hosting supports
              - nvm use 16
              - node -v
              - echo -e "@oxygen:registry=https://registry.npmjs.org/\nstrict-peer-dependencies=false\nauto-install-peers=true\nshamefully-hoist=true" > .npmrc
          build:
            commands:
              - echo FRONTEND HELP BUILD
              # Cleans all pkg and app folders of nm, turbo, dist and .next
              - ./scripts/clean.sh
              - nvm install 16.13 # NodeJS 16.13+ is the latest version that Amplify Hosting supports
              - nvm use 16
              - node -v
              - npx pnpm install
              # - aws s3 cp amplify.yml s3://main-sandbox/public/
              # - yarn amplify:clean:current-backend
              - npx pnpm run help:build
          postBuild:
            commands:
              - echo END OF HELP BUILD
        artifacts:
          # Base directory should just be next. If you set it to apps/someapp when the build finishes it would then be apps/someapp/apps/someapp/.next and that is wrong.
          baseDirectory: .next
          files:
            - "**/*"
        cache:
          paths:
            - node_modules/**/*


### Log output

<details>

Logs

                             # Starting phase: preBuild
                             # Executing command: echo FRONTEND HELP PREBUILD
                             FRONTEND HELP PREBUILD
                             # Executing command: cd ../../

2022-12-05T21:13:44.852Z [INFO]: # Executing command: nvm install 16.13
2022-12-05T21:13:45.481Z [WARNING]: v16.13.2 is already installed.
2022-12-05T21:13:56.774Z [INFO]: Now using node v16.13.2 (npm v8.1.2)
2022-12-05T21:13:56.776Z [INFO]: Installing default global packages from /root/.nvm/default-packages...
npm install -g --quiet yarn@1.22.0
2022-12-05T21:13:59.290Z [INFO]: changed 1 package, and audited 2 packages in 2s
2022-12-05T21:13:59.290Z [INFO]: found 0 vulnerabilities
2022-12-05T21:13:59.300Z [INFO]: # Executing command: nvm use 16
2022-12-05T21:13:59.660Z [INFO]: Now using node v16.18.1 (npm v8.19.2)
2022-12-05T21:13:59.660Z [INFO]: # Executing command: node -v
2022-12-05T21:13:59.663Z [INFO]: v16.18.1
2022-12-05T21:13:59.663Z [INFO]: # Executing command: echo -e "@oxygen:registry=https://registry.npmjs.org/\nstrict-peer-dependencies=false\nauto-install-peers=true\nshamefully-hoist=true" > .npmrc
2022-12-05T21:13:59.663Z [INFO]: # Completed phase: preBuild
# Starting phase: build
# Executing command: echo FRONTEND HELP BUILD
FRONTEND HELP BUILD
2022-12-05T21:13:59.664Z [INFO]: # Executing command: ./scripts/clean.sh
2022-12-05T21:14:30.483Z [INFO]: # Executing command: nvm install 16.13
2022-12-05T21:14:31.111Z [WARNING]: v16.13.2 is already installed.
2022-12-05T21:14:31.415Z [INFO]: Now using node v16.13.2 (npm v8.1.2)
2022-12-05T21:14:31.415Z [INFO]: Installing default global packages from /root/.nvm/default-packages...
npm install -g --quiet yarn@1.22.0
2022-12-05T21:14:31.989Z [INFO]: changed 1 package, and audited 2 packages in 463ms
2022-12-05T21:14:31.990Z [INFO]: found 0 vulnerabilities
2022-12-05T21:14:32.000Z [INFO]: # Executing command: nvm use 16
2022-12-05T21:14:32.378Z [INFO]: Now using node v16.18.1 (npm v8.19.2)
2022-12-05T21:14:32.378Z [INFO]: # Executing command: node -v
2022-12-05T21:14:32.381Z [INFO]: v16.18.1
2022-12-05T21:14:32.381Z [INFO]: # Executing command: npx pnpm install
2022-12-05T21:14:33.416Z [WARNING]: npm
2022-12-05T21:14:33.416Z [WARNING]: WARN exec The following package was not found and will be installed: pnpm@7.18.0
2022-12-05T21:14:34.396Z [INFO]: Scope: all 7 workspace projects
2022-12-05T21:14:34.740Z [INFO]: Progress: resolved 1, reused 0, downloaded 0, added 0
2022-12-05T21:14:35.748Z [INFO]: Progress: resolved 25, reused 0, downloaded 8, added 0
2022-12-05T21:14:36.753Z [INFO]: Progress: resolved 42, reused 0, downloaded 25, added 0
2022-12-05T21:14:37.754Z [INFO]: Progress: resolved 55, reused 0, downloaded 36, added 0
2022-12-05T21:14:38.266Z [INFO]: packages/design-system |  WARN  deprecated rollup-plugin-terser@7.0.2
2022-12-05T21:14:38.757Z [INFO]: Progress: resolved 70, reused 0, downloaded 52, added 0
2022-12-05T21:14:39.767Z [INFO]: Progress: resolved 95, reused 0, downloaded 72, added 0
2022-12-05T21:14:40.771Z [INFO]: Progress: resolved 109, reused 0, downloaded 92, added 0
2022-12-05T21:14:41.775Z [INFO]: Progress: resolved 125, reused 0, downloaded 109, added 0
2022-12-05T21:14:42.777Z [INFO]: Progress: resolved 151, reused 0, downloaded 136, added 0
2022-12-05T21:14:43.781Z [INFO]: Progress: resolved 194, reused 0, downloaded 165, added 0
2022-12-05T21:14:44.793Z [INFO]: Progress: resolved 202, reused 0, downloaded 173, added 0
2022-12-05T21:14:45.832Z [INFO]: Progress: resolved 217, reused 0, downloaded 186, added 0
2022-12-05T21:14:46.838Z [INFO]: Progress: resolved 232, reused 0, downloaded 200, added 0
2022-12-05T21:14:47.840Z [INFO]: Progress: resolved 262, reused 0, downloaded 227, added 0
2022-12-05T21:14:48.277Z [INFO]: packages/design-system |  WARN  deprecated @types/cssnano@5.1.0
2022-12-05T21:14:48.844Z [INFO]: Progress: resolved 293, reused 0, downloaded 258, added 0
2022-12-05T21:14:49.846Z [INFO]: Progress: resolved 333, reused 0, downloaded 292, added 0
2022-12-05T21:14:50.859Z [INFO]: Progress: resolved 381, reused 0, downloaded 329, added 0
2022-12-05T21:14:51.860Z [INFO]: Progress: resolved 413, reused 0, downloaded 362, added 0
2022-12-05T21:14:52.850Z [INFO]: apps/help |  WARN  deprecated sourcemap-codec@1.4.8
2022-12-05T21:14:52.864Z [INFO]: Progress: resolved 450, reused 0, downloaded 397, added 0
2022-12-05T21:14:53.458Z [INFO]: apps/main |  WARN  deprecated uuid@3.4.0
2022-12-05T21:14:53.865Z [INFO]: Progress: resolved 493, reused 0, downloaded 438, added 0
2022-12-05T21:14:54.050Z [INFO]: apps/main |  WARN  deprecated uuid@3.3.2
2022-12-05T21:14:54.777Z [INFO]: apps/main |  WARN  deprecated @aws-sdk/eventstream-marshaller@3.6.1
2022-12-05T21:14:54.871Z [INFO]: Progress: resolved 515, reused 0, downloaded 461, added 0
2022-12-05T21:14:55.789Z [INFO]: apps/main |  WARN  deprecated @aws-sdk/util-base64-browser@3.6.1
2022-12-05T21:14:55.806Z [INFO]: apps/main |  WARN  deprecated @aws-sdk/util-base64-node@3.6.1
2022-12-05T21:14:55.871Z [INFO]: Progress: resolved 555, reused 0, downloaded 495, added 0
2022-12-05T21:14:56.881Z [INFO]: Progress: resolved 578, reused 0, downloaded 526, added 0
2022-12-05T21:14:57.883Z [INFO]: Progress: resolved 618, reused 0, downloaded 555, added 0
2022-12-05T21:14:58.887Z [INFO]: Progress: resolved 675, reused 0, downloaded 612, added 0
2022-12-05T21:14:59.889Z [INFO]: Progress: resolved 798, reused 0, downloaded 705, added 0
2022-12-05T21:15:00.893Z [INFO]: Progress: resolved 884, reused 0, downloaded 786, added 0
2022-12-05T21:15:01.217Z [INFO]: apps/main |  WARN  deprecated @aws-sdk/util-base64-browser@3.186.0
2022-12-05T21:15:01.218Z [INFO]: apps/main |  WARN  deprecated @aws-sdk/util-base64-node@3.186.0
2022-12-05T21:15:01.892Z [INFO]: Progress: resolved 957, reused 0, downloaded 864, added 0
2022-12-05T21:15:02.892Z [INFO]: Progress: resolved 1013, reused 0, downloaded 913, added 0
2022-12-05T21:15:03.893Z [INFO]: Progress: resolved 1128, reused 0, downloaded 1015, added 0
2022-12-05T21:15:04.893Z [INFO]: Progress: resolved 1239, reused 0, downloaded 1122, added 0
2022-12-05T21:15:05.565Z [INFO]: apps/main |  WARN  deprecated querystring@0.2.0
2022-12-05T21:15:05.893Z [INFO]: Progress: resolved 1340, reused 0, downloaded 1222, added 0
2022-12-05T21:15:06.893Z [INFO]: Progress: resolved 1432, reused 0, downloaded 1302, added 0
2022-12-05T21:15:07.425Z [INFO]: packages/design-system |  WARN  deprecated stable@0.1.8
2022-12-05T21:15:07.894Z [INFO]: Progress: resolved 1526, reused 0, downloaded 1391, added 0
2022-12-05T21:15:08.941Z [INFO]: Progress: resolved 1568, reused 0, downloaded 1481, added 0
2022-12-05T21:15:09.947Z [INFO]: Progress: resolved 1617, reused 0, downloaded 1524, added 0
2022-12-05T21:15:10.961Z [INFO]: Progress: resolved 1670, reused 0, downloaded 1580, added 0
2022-12-05T21:15:12.033Z [INFO]: Progress: resolved 1756, reused 0, downloaded 1657, added 0
2022-12-05T21:15:13.034Z [INFO]: Progress: resolved 1851, reused 0, downloaded 1738, added 0
2022-12-05T21:15:13.123Z [INFO]: apps/main |  WARN  deprecated uglify-es@3.3.9
2022-12-05T21:15:13.286Z [INFO]: apps/main |  WARN  deprecated source-map-resolve@0.5.3
2022-12-05T21:15:13.444Z [INFO]: apps/main |  WARN  deprecated resolve-url@0.2.1
2022-12-05T21:15:13.461Z [INFO]: apps/main |  WARN  deprecated source-map-url@0.4.1
2022-12-05T21:15:13.475Z [INFO]: apps/main |  WARN  deprecated urix@0.1.0
2022-12-05T21:15:14.277Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1847, added 0
2022-12-05T21:15:14.294Z [INFO]: Packages: +1905
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2022-12-05T21:15:15.405Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1848, added 0
2022-12-05T21:15:15.518Z [INFO]: Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /codebuild/output/.pnpm-store/v3
Virtual store is at: node_modules/.pnpm
2022-12-05T21:15:16.405Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1895, added 137
2022-12-05T21:15:17.406Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1895, added 164
2022-12-05T21:15:18.445Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1895, added 165
2022-12-05T21:15:19.445Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1897, added 473
2022-12-05T21:15:20.444Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1898, added 769
2022-12-05T21:15:21.449Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1898, added 1108
2022-12-05T21:15:22.449Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1898, added 1564
2022-12-05T21:15:23.459Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1898, added 1844
2022-12-05T21:15:24.459Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1898, added 1904
2022-12-05T21:15:26.172Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1899, added 1904
2022-12-05T21:15:26.472Z [INFO]: .../node_modules/core-js-pure postinstall$ node -e "try{require('./postinstall')}catch(e){}"
2022-12-05T21:15:26.513Z [INFO]: .../swiper@8.4.5/node_modules/swiper postinstall$ node -e "try{require('./postinstall')}catch(e){}"
2022-12-05T21:15:26.554Z [INFO]: .../node_modules/core-js-pure postinstall: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
2022-12-05T21:15:26.556Z [INFO]: .../node_modules/core-js-pure postinstall: The project needs your help! Please consider supporting of core-js:
.../node_modules/core-js-pure postinstall: > https://opencollective.com/core-js
.../node_modules/core-js-pure postinstall: > https://patreon.com/zloirock
.../node_modules/core-js-pure postinstall: > bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
.../node_modules/core-js-pure postinstall: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
2022-12-05T21:15:26.558Z [INFO]: .../node_modules/core-js-pure postinstall: Done
2022-12-05T21:15:26.670Z [INFO]: .../swiper@8.4.5/node_modules/swiper postinstall: Done
2022-12-05T21:15:26.710Z [INFO]: .../node_modules/maplibre-gl postinstall$ node ./postinstall.js
2022-12-05T21:15:26.794Z [INFO]: .../node_modules/maplibre-gl postinstall: Done
2022-12-05T21:15:27.136Z [INFO]: .../.pnpm/turbo@1.6.3/node_modules/turbo postinstall$ node install.js
2022-12-05T21:15:27.137Z [INFO]: .../esbuild@0.15.18/node_modules/esbuild postinstall$ node install.js
2022-12-05T21:15:27.196Z [INFO]: Progress: resolved 1937, reused 0, downloaded 1899, added 1905, done
2022-12-05T21:15:27.229Z [INFO]: .../.pnpm/turbo@1.6.3/node_modules/turbo postinstall: Done
2022-12-05T21:15:27.305Z [INFO]: .../esbuild@0.15.18/node_modules/esbuild postinstall: Done
2022-12-05T21:15:29.220Z [INFO]: devDependencies:
+ @mui/types 7.2.2
+ @types/cors 2.8.13
+ @types/google.maps 3.50.5
+ @types/gtag.js 0.0.12
+ @types/is-ci 3.0.0
+ @types/loadjs 4.0.1
+ @types/lodash 4.14.191
+ @types/node 18.11.11
+ @types/object-hash 3.0.0 (3.0.1 is available)
+ @types/react 18.0.26
+ @types/react-dom 18.0.9
+ @types/uuid 9.0.0
+ commitizen 4.2.5
+ eslint 8.29.0
+ husky 8.0.2
+ is-ci 3.0.1
+ lint-staged 13.1.0
+ prettier 2.8.0
+ pretty-quick 3.1.3
+ rimraf 3.0.2
+ shx 0.3.4
+ ts-jest 29.0.3
+ ts-node 10.9.1
+ tsup 6.5.0
+ turbo 1.6.3
+ typescript 4.9.3
2022-12-05T21:15:29.222Z [INFO]: WARN  Issues with peer dependencies found
apps/main
└─┬ react-native 0.70.6
└── ✕ unmet peer react@18.1.0: found 18.2.0
2022-12-05T21:15:29.224Z [INFO]: Done in 55.2s
2022-12-05T21:15:29.280Z [INFO]: # Executing command: npx pnpm run help:build
2022-12-05T21:15:37.788Z [INFO]: > @oxygen/repo@0.0.0 help:build /codebuild/output/src312015397/src/fox
> turbo run build --filter=@oxygen/help
2022-12-05T21:15:37.923Z [INFO]: • Packages in scope: @oxygen/help
• Running build in 1 packages
• Remote caching disabled
2022-12-05T21:15:37.924Z [INFO]: @oxygen/design-system:build: cache miss, executing 3091a27cf8ffeeeb
2022-12-05T21:15:38.319Z [INFO]: @oxygen/design-system:build:
@oxygen/design-system:build: > @oxygen/design-system@0.0.0 build /codebuild/output/src312015397/src/fox/packages/design-system
@oxygen/design-system:build: > pnpm run build:ts
@oxygen/design-system:build:
2022-12-05T21:15:38.721Z [INFO]: @oxygen/design-system:build:
@oxygen/design-system:build: > @oxygen/design-system@0.0.0 build:ts /codebuild/output/src312015397/src/fox/packages/design-system
@oxygen/design-system:build: > rollup --config
@oxygen/design-system:build:
2022-12-05T21:15:39.265Z [INFO]: @oxygen/design-system:build: �[36m
@oxygen/design-system:build: �[1m./src/index.tsx, ./src/internal.tsx�[22m → �[1mdist�[22m...�[39m
2022-12-05T21:15:54.440Z [INFO]: @oxygen/design-system:build: �[1m�[33m(!) Circular dependency�[39m�[22m
@oxygen/design-system:build: src/core/theme/index.tsx -> src/core/mui/components/index.tsx -> src/core/mui/components/baseline/index.tsx -> src/core/theme/index.tsx
2022-12-05T21:15:54.442Z [INFO]: @oxygen/design-system:build: �[1m�[33m(!) Plugin typescript: @rollup/plugin-typescript: outputToFilesystem option is defaulting to true.�[39m�[22m
@oxygen/design-system:build: �[32mcreated �[1mdist�[22m in �[1m15.1s�[22m�[39m
@oxygen/design-system:build: �[36m
@oxygen/design-system:build: �[1m./src/index.tsx, ./src/internal.tsx�[22m → �[1mdist/esm�[22m...�[39m
2022-12-05T21:16:06.321Z [INFO]: @oxygen/design-system:build: �[1m�[33m(!) Circular dependency�[39m�[22m
@oxygen/design-system:build: src/core/theme/index.tsx -> src/core/mui/components/index.tsx -> src/core/mui/components/baseline/index.tsx -> src/core/theme/index.tsx
@oxygen/design-system:build: �[1m�[33m(!) Plugin typescript: @rollup/plugin-typescript: outputToFilesystem option is defaulting to true.�[39m�[22m
2022-12-05T21:16:06.322Z [INFO]: @oxygen/design-system:build: �[32mcreated �[1mdist/esm�[22m in �[1m11.8s�[22m�[39m
@oxygen/design-system:build: �[36m
@oxygen/design-system:build: �[1m./src/styles.ts�[22m → �[1mdist�[22m...�[39m
2022-12-05T21:16:06.325Z [INFO]: @oxygen/design-system:build: �[1m�[33m(!) Generated an empty chunk�[39m�[22m
2022-12-05T21:16:06.326Z [INFO]: @oxygen/design-system:build: styles
@oxygen/design-system:build: �[32mcreated �[1mdist�[22m in �[1m4ms�[22m�[39m
2022-12-05T21:16:06.405Z [INFO]: @oxygen/help:build: cache miss, executing 781292d0a63e98ce
2022-12-05T21:16:06.828Z [INFO]: @oxygen/help:build:
@oxygen/help:build: > @oxygen/help@0.0.0 build /codebuild/output/src312015397/src/fox/apps/help
@oxygen/help:build: > next build
@oxygen/help:build:
2022-12-05T21:16:07.082Z [INFO]: @oxygen/help:build: info - Loaded env from /codebuild/output/src312015397/src/fox/apps/help/.env
2022-12-05T21:16:07.198Z [INFO]: @oxygen/help:build: warn - You have enabled experimental features (esmExternals, transpilePackages) in next.config.js.
@oxygen/help:build: warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
2022-12-05T21:16:07.198Z [INFO]: @oxygen/help:build:
2022-12-05T21:16:07.200Z [INFO]: @oxygen/help:build: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2022-12-05T21:16:07.213Z [INFO]: @oxygen/help:build: Attention: Next.js now collects completely anonymous telemetry regarding usage.
@oxygen/help:build: This information is used to shape Next.js' roadmap and prioritize features.
@oxygen/help:build: 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:
2022-12-05T21:16:07.213Z [INFO]: @oxygen/help:build: https://nextjs.org/telemetry
@oxygen/help:build:
2022-12-05T21:16:07.306Z [INFO]: @oxygen/help:build: info - Skipping validation of types
@oxygen/help:build: info - Skipping linting
2022-12-05T21:16:07.611Z [INFO]: @oxygen/help:build: info - Creating an optimized production build...
2022-12-05T21:16:20.574Z [INFO]: @oxygen/help:build: info - Compiled successfully
2022-12-05T21:16:20.575Z [INFO]: @oxygen/help:build: info - Collecting page data...
2022-12-05T21:16:22.043Z [INFO]: @oxygen/help:build: info - Generating static pages (0/10)
2022-12-05T21:16:22.254Z [INFO]: @oxygen/help:build: info - Generating static pages (2/10)
2022-12-05T21:16:22.282Z [INFO]: @oxygen/help:build: info - Generating static pages (4/10)
2022-12-05T21:16:22.334Z [INFO]: @oxygen/help:build: info - Generating static pages (7/10)
2022-12-05T21:16:22.362Z [INFO]: @oxygen/help:build: info - Generating static pages (10/10)
2022-12-05T21:16:22.375Z [INFO]: @oxygen/help:build: info - Finalizing page optimization...
2022-12-05T21:16:22.380Z [INFO]: @oxygen/help:build:
2022-12-05T21:16:22.400Z [INFO]: @oxygen/help:build: Route (pages) Size First Load JS
@oxygen/help:build: ┌ ○ / 354 B 152 kB
@oxygen/help:build: ├ /_app 0 B 152 kB
@oxygen/help:build: ├ ○ /404 300 B 152 kB
@oxygen/help:build: ├ ○ /500 300 B 152 kB
2022-12-05T21:16:22.401Z [INFO]: @oxygen/help:build: ├ ○ /policies/privacy-policy 14.1 kB 166 kB
@oxygen/help:build: └ ○ /policies/terms 16.7 kB 168 kB
@oxygen/help:build: + First Load JS shared by all 155 kB
@oxygen/help:build: ├ chunks/framework-237fe0376e1e501c.js 45.4 kB
@oxygen/help:build: ├ chunks/main-cede4fabc64a75f1.js 27.5 kB
@oxygen/help:build: ├ chunks/pages/_app-908afa285fbb9ed1.js 77.8 kB
@oxygen/help:build: ├ chunks/webpack-e467afb76eb05178.js 984 B
@oxygen/help:build: └ css/83bc31cdf5c3ce12.css 3.51 kB
@oxygen/help:build:
@oxygen/help:build: ○ (Static) automatically rendered as static HTML (uses no initial props)
@oxygen/help:build:
2022-12-05T21:16:22.620Z [INFO]:
2022-12-05T21:16:22.620Z [INFO]: Tasks: 2 successful, 2 total
Cached: 0 cached, 2 total
Time: 44.813s
2022-12-05T21:16:23.614Z [INFO]: # Completed phase: build
# Starting phase: postBuild
2022-12-05T21:16:23.614Z [INFO]: # Executing command: echo END OF HELP BUILD
END OF HELP BUILD
# Completed phase: postBuild
2022-12-05T21:16:23.671Z [INFO]: ## Build completed successfully
2022-12-05T21:16:23.752Z [INFO]: # Starting caching...
2022-12-05T21:16:23.762Z [INFO]: # Creating cache artifact...
2022-12-05T21:18:54.835Z [INFO]: # Created cache artifact
2022-12-05T21:18:54.896Z [INFO]: # Uploading cache artifact...
2022-12-05T21:19:21.542Z [INFO]: # Uploaded cache artifact
2022-12-05T21:19:21.649Z [INFO]: # Caching completed
2022-12-05T21:19:21.656Z [INFO]: Setting NEXT_PRIVATE_STANDALONE=true to produce .next/standalone directory
2022-12-05T21:19:21.665Z [INFO]: # No custom headers found.
2022-12-05T21:19:24.479Z [INFO]: # Starting environment caching...
2022-12-05T21:19:24.480Z [INFO]: # Uploading environment cache artifact...
2022-12-05T21:19:24.545Z [INFO]: # Uploaded environment cache artifact
2022-12-05T21:19:24.546Z [INFO]: # Environment caching completed
Terminating logging...


</details>


### Additional information

_No response_
@Rafcin Rafcin added bug Something isn't working pending-triage labels Dec 5, 2022
@ghost
Copy link

ghost commented Dec 6, 2022

Hi @Rafcin 👋🏽 thanks for raising this issue and providing detailed information. We are investigating this issue with monorepos and SSR deployments and are working to find a solution as soon as possible. We will post an update once we have next steps.

@Rafcin
Copy link
Author

Rafcin commented Dec 6, 2022

@hloriana Awesome, much appreciated! Lmk if you need any thing!

@jbreemhaar
Copy link

jbreemhaar commented Dec 7, 2022

@hloriana, @Rafcin Not sure if related but I fixed this issue in my project by adding the following to nextConfig.experimental. My project uses yarn workspaces, not Turbo though.

    outputFileTracingRoot: path.join(__dirname, "../.."),

I noticed my project throwing 500s when migration from SSG to SSR, within cloudwatch I noticed it was throwing the following error.

Error: Cannot find module 'next/dist/server/next-server'
--

There's more info in this thread: vercel/next.js#39432

@Rafcin
Copy link
Author

Rafcin commented Dec 7, 2022

@jbreemhaar lemme give it a try! I feel like I have this config, not sure.

@Rafcin
Copy link
Author

Rafcin commented Dec 7, 2022

For ref here is my NextJS config

/* eslint-disable turbo/no-undeclared-env-vars */
/* eslint-disable import/order */
const path = require('path')

const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
})
/**
 * @note(pnpm) pass ENV variable to determine if we should transpile
 *            ./src  == transpile
 *            ./dist != transpile
 */

const transpilePackages = ["@oxygen/design-system"]

const withMDX = require('@next/mdx')({
  extension: /\.mdx?$/,
  options: {
    remarkPlugins: [],
    rehypePlugins: [],
    // If you use `MDXProvider`, uncomment the following line.
    providerImportSource: "@mdx-js/react",
    pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
  },
})

const PROTOCOL = {
  HTTP: 'http',
  HTTPS: 'https',
}
const protocol = PROTOCOL.HTTPS
/**
 * @note(pnpm) until we move "websites" into "packages"...
 *
 * When developing locally:
 * - pnpm dev:ds
 * - OR update .env => pnpm dev
 *
 * This maps all the externals required for proper localized
 *  files system path mapping.
 */
const isLocal = process.env.DESIGN_SYSTEM__LINK === 'true' ? true : false
const externals = [
  '@types/react',
  'react',
  'react-dom',
]
const isLocalDebugMessages = [
  `warn  - [ 📝 ]  pnpm link...`,
  `warn  - [ 🔗 ]  @oxygen/design-system`,
]

/**
 * @note The following environment variables are required
 */
const envRequired = [
  'GH_TOKEN',
  'NEXT_PUBLIC_SITE',
]
envRequired.map((item) => {
  if (!process.env[item]) {
    throw new Error(`process.env.${item} is not set in env`)
  }
})

/**
 * @type {import('next').NextConfig}
 **/
const nextConfig = {
  reactStrictMode: true,
  amp: {
    canonicalBase: undefined,
  },
  // analyticsId: 'SELF_HOSTED_ONLY',
  assetPrefix: undefined,
  basePath: '',
  cleanDistDir: true,
  compiler: {},
  compress: true,
  // crossOrigin: 'same-origin',
  devIndicators: { buildActivity: true, buildActivityPosition: 'bottom-right' },
  distDir: './.next',
  // env,
  eslint: {
    // @note(eslint) handled outside of next
    ignoreDuringBuilds: true,
  },
  excludeDefaultMomentLocales: true,
  experimental: {
    appDir: false,
    legacyBrowsers: false,
    esmExternals: "loose",
    transpilePackages,
  },
  httpAgentOptions: {
    keepAlive: true,
  },
  i18n: {
    locales: ['en'],
    defaultLocale: 'en',
  },
  images: {
    deviceSizes: [743, 744, 1127, 1128, 1440],
    imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
    domains: [
      "NA",
      "**.amazonws.com",
      "NA",
      "**.googleapis.com",
    ],
    remotePatterns: [
      {
        protocol,
        hostname: `**.${process.env.NEXT_PUBLIC_SITE}`,
      },
      // @note(remotePattern) Google Apis
      {
        protocol,
        hostname: `**.googleapis.com`,
      },
      // @note(remotePattern) Future proofing "other" websites
      {
        protocol,
        hostname: `**.NA.com`,
      },
      // @note(remotePattern) AWS
      {
        protocol,
        hostname: `**.amazonaws.com`,
      },
      // @note(remotePattern) Twitter
      {
        protocol,
        hostname: `pbs.twimg.com`,
      },
      // @note(remotePattern) Unsplash
      {
        protocol,
        hostname: `images.unsplash.com`,
      },
    ],
    formats: ["image/avif", "image/webp"],
    minimumCacheTTL: 18144000, // 1 month
  },
  onDemandEntries: {
    /**
     * @note(next)
     * period (in ms) where the server will keep pages in the buffer
     */
    maxInactiveAge: 15 * 1000,
    /**
     * @note(next)
     * number of pages that should be kept simultaneously without being disposed
     */
    pagesBufferLength: 2,
  },
  optimizeFonts: true,
  output: undefined,
  outputFileTracing: true,
  outputFileTracingRoot: path.join(__dirname, "../.."),
  pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
  poweredByHeader: false,
  productionBrowserSourceMaps: true,
  publicRuntimeConfig: {
    // @note(next) available on server and client
  },
  sassOptions: {},
  serverRuntimeConfig: {
    // @note(next) available on the server
  },
  staticPageGenerationTimeout: 60,
  swcMinify: true,
  trailingSlash: false,
  typescript: {
    // @note(typescript) handled outside of next
    ignoreBuildErrors: true,
  },
  // @note(next) false will block: ./pages
  useFileSystemPublicRoutes: true,
  // @ts-ignore
  webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
    // @note(pnpm)  path mapping if working locally
    if (isLocal) {
      isLocalDebugMessages.map((msg) =>
        console.debug('\x1b[33m%s\x1b[0m', 'warn', ' - ', msg)
      )
      externals.map((ext) => {
        console.debug('\x1b[33m%s\x1b[0m', 'warn', ' - [ 📦 ] ›  ', ext)
        // @note(npmrc) shamefully-hoist === node_modules at root
        // @todo(npmrc) would be nice to not shamefully-hoist
        config.resolve.alias[ext] = path.resolve(
          __dirname,
          '..',
          '..',
          'node_modules',
          ext
        )
      })
    }

    return config
  },
}

/**
 * @note
 * Plugins cannot handle their own Configuration at this time.
 */
 const plugins = [withBundleAnalyzer, withMDX]
 module.exports = plugins.reduce((config, plugin) => plugin(config), nextConfig)

@Rafcin
Copy link
Author

Rafcin commented Dec 7, 2022

@jbreemhaar Unfortunately, that did not change anything :(

@jbreemhaar
Copy link

Hmm bummer :/.
Have you checked your cloudwatch logs?

@Rafcin
Copy link
Author

Rafcin commented Dec 7, 2022

I don't have access to anything behind the scenes

@jbreemhaar
Copy link

Ugh thats going to be a hard to find bug. Good luck!

@Rafcin
Copy link
Author

Rafcin commented Dec 7, 2022

We'll see, I'm not super familiar with the next JS standalone deployment. I also don't really have access to the behind the scenes so I don't know what the issue is.

Maybe it's a configuration issue with my next config

@king0120
Copy link

I've also run into this issue when trying to build and deploy a nextjs app using NX as the monorepo. I attempted @jbreemhaar 's fix but unfortunately was met with a build error around the server.js file no longer existing when I set the outputFileTracing to be the root. It appears that where server.js normally is, the entrypoint seems to be apps/APP_NAME/server.js

@Rafcin
Copy link
Author

Rafcin commented Dec 12, 2022

@hloriana Have there been any updates to this issue? It currently prevents me from deploying my project using the new system.

@ghost ghost self-assigned this Dec 12, 2022
@ghost ghost added investigating and removed pending-triage labels Dec 12, 2022
@Rafcin
Copy link
Author

Rafcin commented Dec 13, 2022

Unsure if related however new canary build of Next had this bug fix reported: vercel/next.js#43746

@DuCanhGH
Copy link

@Rafcin no, my PR is not related to your issue as it fixes an issue with appDir's route groups, which you don't seem to be using. Try moving this lỉne:
outputFileTracingRoot: path.join(__dirname, "../.."),
from your nextConfig to its experimental object as it is still an experimental feature. Also output: undefined won't do a single thing, please use output: "standalone" instead if you want to use Next.js's output file tracing.
You may also want to add // @ts-check to the top of your next.config.js so that it warns you when you have an invalid config.
I don't really know the issue, but this may help a bit :)

@Rafcin
Copy link
Author

Rafcin commented Dec 14, 2022

@DuCanhGH Good to know; my main app actually uses route groups, so I'll keep an eye on that. Let me see if your solution works magic man; give me one moment, and I'll let you know! I appreciate the help! Also, sorry if my reference to the PR pinged you; my apologies!

@DuCanhGH
Copy link

@Rafcin remember to update to the latest canary build :)

@king0120
Copy link

@DuCanhGH @Rafcin So I can report from my end that putting outputFileTracingRoot in experimental and having output: 'standalone' hasn't worked on my end. The build ends up failing with the following error.

 !!! CustomerError: The standalone directory /codebuild/output/src974333853/src/ft-app-nextjs-demo/apps/flashtract-app/dist/.next/standalone is missing a server.js file. This file shoud have been created automatically by NextJS. Make sure you enable output standalone on your next.config.js file or set NEXT_PRIVATE_STANDALONE=true. https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files

Like mentioned above, the server.js that it looks like the app is looking for is nested inside of a couple other directories based on the name of apps inside my monorepo. I don't know if this helps at all, but I tried using the same NX config to deploy to vercel and things seemed to deploy just fine. But would much rather stay on Amplify, since pretty much everything else I use is AWS.

@Rafcin
Copy link
Author

Rafcin commented Dec 14, 2022

@king0120 @DuCanhGH Just ran into the same issue:

2022-12-14T02:48:29.269Z [ERROR]: !!! CustomerError: The standalone directory /codebuild/output/src291575553/src/fox/apps/help/.next/standalone is missing a server.js file. This file shoud have been created automatically by NextJS. Make sure you enable output standalone on your next.config.js file or set NEXT_PRIVATE_STANDALONE=true. https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files

@DuCanhGH
Copy link

@king0120 wait, can you try removing outputFileTracingRoot? I think it may help as the server.js file is output to .next/standalone/[your app's dir relative to the tracing root dir].

@king0120
Copy link

@DuCanhGH so if I remove the outputFileTracingRoot the result is the 500 error mentioned at the beginning of the thread. The root of the 500 seems to be related to not being able to find the root of the projects node modules. Away from my computer for the evening, but the error message in cloudwatch is something along the lines of not being able to find ‘next/dist’

@Rafcin
Copy link
Author

Rafcin commented Dec 14, 2022

This is what the build ouput looks like when I build the app locally with standalone output enabled and outputFileTracingRoot: path.join(__dirname, "../..") inside apps/help/.next is the server.js file.
Screenshot from 2022-12-13 19-25-09

@DuCanhGH
Copy link

DuCanhGH commented Dec 14, 2022

@king0120 @Rafcin hmm, I think having outputFileTracingRoot makes sense, but it is weird that what seems to be aws-amplify is only checking for .next/standalone/server.js. Can you guys make it check for .next/standalone/[your app's dir relative to your root]/server.js instead? Like, by marking it the entrypoint instead of the aforementioned?

@DuCanhGH
Copy link

@lephuongbg probably because that folder is at .next/standalone/your_app/static, rather than what aws-amplify expected to see, which is probably .next/standalone/static? Just my guesswork, btw.

@lephuongbg
Copy link

@DuCanhGH static asset folder is always .next/static though, for both single repo & monorepos.

@DuCanhGH
Copy link

@lephuongbg oh, yeah that's true. Maybe you can try copying that folder to .next/standalone/[your_app] instead?

@lephuongbg
Copy link

lephuongbg commented Dec 21, 2022

Finally make it works. Basically had to:

  1. Disable pnpm symlinking node_modules by having node-linker=hoisted in project root's .npmrc. Without this, step 3 is impossible.
  2. Make sure outputFileTracingRoot: path.join(__dirname, '../..') is set correctly in next.config.js. Otherwise, build output won't contain all necessary dependencies.
  3. After build, shoehorn the mono-repos' .next/standalone structure to make it look like single-repo .next/standalone. My command is similar to Nextjs Turbo Monorepo 500 Error #3179 (comment) but uses rsync to be on the safe-side when merging .next/standalone/[app]/node_modules and .next/standalone/node_modules:
build:
  commands:
    - cd ../.. && pnpm run build:storefront && cd apps/storefront
    - rsync .next/standalone/apps/storefront/ .next/standalone/ -a --copy-links -v && rm -r .next/standalone/apps
appRoot: apps/storefront

@Rafcin
Copy link
Author

Rafcin commented Dec 21, 2022

I'm going to try this out once I can fix my console, for some reason now I'm getting network failures when trying to list amplify apps. One issues fixed and 100 more take its place.

@king0120
Copy link

king0120 commented Jan 2, 2023

Wonder if anyone on the Amplify team has opinions on this? Would be great to know if there was any sort of priority to fix the monorepo issues.

@ghost
Copy link

ghost commented Jan 12, 2023

Hello everyone who has been engaged on this issue! 👋🏽 Thank you all for your continued patience. The Amplify team is actively working on supporting the ability to host Next.js apps that use monorepo frameworks and this task is a priority for the team. We will continue to provide updates as we make progress with this task.

@chrisl777
Copy link

@hloriana Thanks for letting us know that the team is looking into monorepo support! 👏

Is there a proposal or central issue requesting feedback for tracking monorepo tooling support?

Also, how soon might there be some resolution? I'm trying to find clear examples of sharing code between apps within my repo, along with using Amplify. I have some pressing projects where I'll need to decide on an approach.

The current Amplify docs have a basic example of using multiple front-end projects, but does not appear to address sharing code between them.

Also, it seems odd to attach or instantiate Amplify to one front-end project, as the docs seem to suggest. Rather, it would be nice if the backend was another "package" within the monorepo, and API files could more readily be shared (along with sharing common wrappers that we write for those APIs).

The options out there appear to be yarn workspaces, along with Lerna, Nx, Turborepo, etc. It would be super amazing to have some clear docs and examples!

@ScottAwesome
Copy link

Hello everyone who has been engaged on this issue! 👋🏽 Thank you all for your continued patience. The Amplify team is actively working on supporting the ability to host Next.js apps that use monorepo frameworks and this task is a priority for the team. We will continue to provide updates as we make progress with this task.

@hloriana Any updates on this? Its been over a month now and I haven't seen any movement on this, we are considering lift and shifting our entire frontend to outside AWS services as a result, the features around Amplify hosting and this specifically are extremely limiting and its starting to feel like Amazon is slowly abandoning the product line

@michrome
Copy link

Hey @chrisl777 @lephuongbg @thijsdaniels @king0120 @Rafcin @jbreemhaar @ScottAwesome @DuCanhGH @hloriana 👋

Work to better support monorepos is underway and we're looking for volunteers to help test we're heading in the right direction. If you're interested in testing a beta with an app that's part of a monorepo, please reach out to me at jrm@amazon.com. We'd particularly appreciate hearing from npm workspace, yarn workspace, pnpm workspace and NX workspace users. Thanks!

@Rafcin
Copy link
Author

Rafcin commented Feb 27, 2023

@michrome I've built some personal monorepo apps that gave even Vercel a stroke to deploy. I'm down to test this new system out! I'll shoot you an email!

@ryankauk
Copy link

ryankauk commented Mar 9, 2023

Took a whole lot of tinkering, but I finally got it.

This is what worked for me

Using:

  • PNPM@7.26.3 (cached Content-addressable store)
  • Turborepo@1.8.3 (with cache) (warning some earlier versions of turborepo cause next build with standalone to hang and amplify build will hang and eventually cause "Build timed out")
  • NextJS@13 appDir
  • Branch framework "Next.js - SSR" (not quite sure what this does but read in random places this is needed)
  • Amplify platform "WEB_COMPUTE" (required apparently for any nextjs > 11)
  • next.config.js
const path = require('path')
console.log("envs", process.env.NEXT_PRIVATE_STANDALONE, process.env.AMPLIFY_MONOREPO_APP_ROOT)
/** @type {import('next').NextConfig} */

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  experimental: {
    appDir: true,
  },
  // ignore these for now to speed up debugging builds
  eslint: { ignoreDuringBuilds: true },
  typescript: { ignoreBuildErrors: true }
}

module.exports = nextConfig
  • build spec:
version: 1
applications:
  - appRoot: apps/frontend/amplify-next
    # not quite sure what the env.variables do but they don't get passed into next build with process.env. They must get added somewhere else
    env:
      variables: {}
    frontend:
      phases:
        preBuild:
          commands:
            - npm install -g pnpm
            - sh -c 'cd ../../.. && pnpm config set store-dir ./.pnpm-store'
            - pnpm install --prefer-offline --filter=amplify-next
        build:
          commands:
            - sh -c 'cd ../../.. && pnpm turbo run build --filter=amplify-next'
            - cp -r .next/static .next/standalone/apps/frontend/amplify-next/.next/static
            - cp -r public .next/standalone/apps/frontend/amplify-next/public
            - echo 'require("./apps/frontend/amplify-next/server.js")' > .next/standalone/server.js
      artifacts:
        baseDirectory: .next
        files:
          - "**/*"
      cache:
        # not matter what you set for appRoot or AMPLIFY_MONOREPO_APP_ROOT cache is always relative to your applications root directory 
        paths:
          - .pnpm-store/**/*
          # - node_modules/.cache/turbo/**/*
  • environment variables (set on amplify application level)
AMPLIFY_MONOREPO_APP_ROOT apps/frontend/amplify-next All branches

NEXT_PRIVATE_STANDALONE seems to be auto injected and nextjs automatically picks this up so nothing is really needed here

AMPLIFY_MONOREPO_APP_ROOT from the docs, is supposedly supposed to be set automatically when you set appRoot but it does not. Without this in this particular spot I would get the error The base directory '.next' you have specified in your amplify.yml does not exist. Make sure you run 'next build' or specify the correct name for your NextJS build directory. even with all the above build spec.

Last outstanding issue

  • How to get CloudWatch logs for host compute

@Rafcin
Copy link
Author

Rafcin commented Mar 10, 2023

Idk if this is done behind the scenes, we should create a directory on amplify-hosting and add a bunch of different example repos that should be deployed by Amplify and redeployed each time there's an update to confirm what works and what doesn't.

@tqhoughton
Copy link

I also struggled with this but was able to get things working using:

turbo@1.8.3
yarn@1.22.19

with my web app located in apps/web

and the following amplify.yml config (thanks to @thijsdaniels for the help with the post build script)

version: 1
applications:
  - frontend:
      phases:
        preBuild:
          commands:
            - yarn install
        build:
          commands:
            - yarn build
        postBuild:
          commands:
            # this copies the files back to the root of the "standalone" folder so Amplify can find them
            # keep an eye on https://github.com/aws-amplify/amplify-hosting/issues/3179
            # for possible long-term fix from the Amplify team
            - cp -r .next/standalone/apps/web/. .next/standalone
      artifacts:
        baseDirectory: .next
        files:
          - '**/*'
      cache:
        paths:
          - node_modules/**/*
    appRoot: apps/web

I also had to add output: 'standalone' to my next.config.js since it wasn't there originally.

@zaytsevandrii
Copy link

I also have problems using AWS Amplify, my e-commerce site works well on verсel, and on AWS pages where data is loaded from the mongo database there are often 500 error, I even tried to change the code from SSR(getServerSideProps) to Useeffect

@MANTENN
Copy link

MANTENN commented Apr 28, 2023

It used to work with:
cp -r apps/app-name/.next/standalone/apps/app-name/ apps/app-name/.next/standalone/
cp -r apps/app-name/.next/standalone/apps/app-name/* apps/app-name/.next/standalone/
without .next folder in the .next/standalone folder

seems like there was an update today that broke our builds—without a warning or a heads up.
updated to:
cp -r apps/app-name/.next/standalone/apps/app-name/.
and added for static files:
cp -r apps/app-name/.next/static/. apps/app-name/.next/standalone/.next/static.

context:

version: 1
applications:
  - frontend:
      phases:
        preBuild:
          commands:
            - npx npm install
        build:
          commands:
            - npx turbo run build --filter=apps/app-name
            - cp -r apps/app-name/.next/standalone/apps/app-name/. apps/app-name/.next/standalone/
             - cp -r apps/app-name/.next/standalone/apps/app-name/* apps/app-name/.next/standalone/
            - cp -r apps/app-name/.next/static/. apps/app-name/.next/standalone/.next/static
      artifacts:
        baseDirectory: apps/app-name/.next
        files:
          - '**/*'
      cache:
        paths:
          - node_modules/**/*
      buildPath: /
    appRoot: apps/app-name

@victorccccc
Copy link
Contributor

victorccccc commented Apr 28, 2023

Hi 👋 @MANTENN, We are gradually onboarding customers to use our new web compute & monorepo feature. Can you please share your appId so we can investigate further? You can also send it to [REDACTED]

Thanks

@victorccccc victorccccc reopened this Apr 28, 2023
@aws-amplify aws-amplify deleted a comment from github-actions bot Apr 28, 2023
@vashisth00
Copy link

So I have this issue in just amplify

I have a root-folder

  • apps
    -- next-app-1
    -- next-app-2

Now my base_url runs on next-app-2 and next-app-1 should run as base_url/app

Same thing works on EC2 with turbo setup such as with deploy.sh like

cd root-app/
sudo git checkout .
sudo git pull origin development
sudo git stash pop
sudo yarn install
sudo yarn build
sudo pm2 kill -a
sudo NODE_ENV=production pm2 --name trybeem start "yarn workspace web-main -- start"
sudo NODE_ENV=production pm2 --name trybeem start "yarn workspace web-app -- start --port 3001"
exit

What to do in amplify to make it work

@victorccccc
Copy link
Contributor

We have provided the support for Compute + Monorepo frameworks.

FAQ link: https://github.com/aws-amplify/amplify-hosting/blob/main/FAQ.md#support-for-monorepo-framework

Please feel free to create new issue if you have additional question.

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 24, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 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. bug Something isn't working compute investigating monorepo
Projects
None yet
Development

No branches or pull requests