aws-amplify / aws-amplify/amplify-hosting

Monorepo kicks off build for folders other than AMPLIFY_MONOREPO_APP_ROOT

Open
#3,453 2 comments 0 reactions 0 assignees View on GitHub
bug compute investigating monorepo
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d2c1le18rkyskx

### AWS Region

us-east-1

### Amplify Hosting feature

Monorepo

### Describe the bug

I am using the monorepo feature which works as intended as far as performing the build of my Next.js app in the correct folder. My git repo's directory structure looks like the following:

-frontend
-backend

I have set `AMPLIFY_MONOREPO_APP_ROOT` equal to `frontend`.

When I commit files to the `backend` folder, however, the build and deployment still kicks off. It only builds the frontend folder (which has no changes), but it should not start unless I make changes to files in the `frontend` folder.

### Expected behavior

I would expect that the build only kicks off if files change in the folder defined by `AMPLIFY_MONOREPO_APP_ROOT`.

### Reproduction steps

Push a commit to a file in a folder other than the one specified by `AMPLIFY_MONOREPO_APP_ROOT`

### Build Settings

```yaml
version: 1
applications:
- backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
appRoot: frontend

```
```

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by committing only to the backend folder while AMPLIFY_MONOREPO_APP_ROOT is set to frontend, using the build settings shown in the report. Start by tracing the monorepo build-trigger handling and compare it with a commit to frontend. Done means backend-only changes do not start a build, while frontend changes still build and deploy the app.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, next.js, yaml
Domain
ci-cd, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.