aws-amplify / aws-amplify/amplify-hosting

[GitHub App] - The PR preview comment should not show before the build is complete

Open
#2,295 1 comment 1 reaction 0 assignees View on GitHub
bug web-previews
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-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

Not relevant

### Region

us-east-1

### Amplify Console feature

Previews

### Describe the bug

The GitHub App comment gets created immediately after the PR gets created.

![](https://user-images.githubusercontent.com/12538019/135631778-c7100c48-7562-4faa-9626-5db8896524da.png)

Unfortunately, this is very much incorrect behaviour. SPA/Next.js apps require a fallback to `index.html`. When visiting a PR preview that doesn't exist yet, it will fall back to the `index.html` of the root of the app (i.e., the `develop`/`main` branch rather than the PR branch). This is regressive behaviour because developers are testing the wrong code without their knowledge.

### Expected behavior

The PR preview comment should only occur after the build is complete. As a side effect, this will afford the behaviour for feature requests like #2294 and showing the failed build logs.

### Reproduction steps

1. Link a GitHub repository
2. Set up PR previews
3. Create a PR
4. Notice that the GitHub App comment gets created immediately, even on a failed build!

### Build Settings

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction steps: link a GitHub repository, configure PR previews, and create a pull request. Trace when the GitHub App comment is created relative to the build, including failed builds; done means the comment appears only after a successful build completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, github
Domain
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.