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

Turborepo fails when its nested two levels down. CustomerError: The 'node_modules' folder is missing the 'next' dependency. #2371

Open
a3har opened this issue Dec 26, 2024 · 1 comment
Labels
bug Something isn't working console-builds Issues related to Amplify console builds

Comments

@a3har
Copy link

a3har commented Dec 26, 2024

Environment information

N/A

Describe the bug

A monorepo that has turborepo managing only a subsection of the monorepo fails to deploy NextJS code. If the entire repo is a turborepo then Amplify seems to have no issues with deployment.

Eg: https://github.com/vercel/turborepo/tree/main/examples/basic

The above example deploys without issues.

However when you nest the turborepo under folders like apps/product-frontend like in the example below, it fails to detect the build artifacts as expected

Eg: https://github.com/a3har/turbo-test

It throws the error below.

[ERROR]: !!! CustomerError: The 'node_modules' folder is missing the 'next' dependency. This is required at runtime to run your application. If you are using a monorepo framework, you may need to do additionalsetup to ensure the necessary runtime dependencies are included in the build output directory Read more: https://github.com/aws-amplify/amplify-hosting/blob/main/FAQ.md#using-a-monorepo-framework

Reproduction steps

Clone the public repo https://github.com/a3har/turbo-test and use the below build settings to deploy.

Env Variables:

  • AMPLIFY_MONOREPO_APP_ROOT=apps/product-frontend/apps/docs
  • AMPLIFY_DIFF_DEPLOY=false
version: 1
applications:
  - frontend:
      buildPath: apps/product-frontend
      phases:
        preBuild:
          commands:
            - npm ci --cache .npm --prefer-offline
        build:
          commands:
            - npx turbo build --filter=docs...
      artifacts:
        baseDirectory: apps/docs/.next
        files:
          - "**/*"
      cache:
        paths:
          - node_modules/**/*
    appRoot: apps/product-frontend/apps/docs
@a3har a3har added the pending-triage Incoming issues that need categorization label Dec 26, 2024
@ykethan ykethan added hosting Issue related to Amplify Hosting console-builds Issues related to Amplify console builds and removed hosting Issue related to Amplify Hosting labels Dec 27, 2024
@Jay2113
Copy link

Jay2113 commented Jan 6, 2025

Hi @a3har 👋 , thanks for reaching out. I was able to reproduce this behavior and will mark it as a bug. I'll report back here with any potential workarounds.

@Jay2113 Jay2113 added bug Something isn't working and removed pending-triage Incoming issues that need categorization labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working console-builds Issues related to Amplify console builds
Projects
None yet
Development

No branches or pull requests

3 participants