aws-amplify / aws-amplify/amplify-hosting

It seems like amplify will sometimes get 404 redirects to / when restoring files

Open
#2,758 1 comment 0 reactions 0 assignees View on GitHub
bug
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.

### App Id

d1gb4dl2lubkkg

### Region

ap-southeast-1

### Amplify Hosting feature

_No response_

### Describe the bug

We deploy via `amplitude publish -c --yes` and we've seen our webworker get bricked because the file is no longer available. I.e. `https://dash.costcenter.net/assets/pivot.worker.84f3f680.worker.js` gets redirected to `ttps://dash.costcenter.net/assets/pivot.worker.84f3f680.worker.js/` post-deployment.

In this case we rarely update `pivot.worker`, and the filename is content hashed, and changed to a new version and later reverted to a previous name.

I strongly suspect the cache invalidation or keeping old files may have an off by 1 error when restoring a file from a previous build. Or there is an issue with cache validation while receiving traffic. Or it's related to this https://github.com/aws-amplify/amplify-cli/issues/4210

### Expected behavior

The file should still be available.

### Reproduction steps

Some version of:

1. Deploy a file
2. amplitude publish -c --yes
3. Remove said file.
4. amplitude publish -c --yes
5. Return said file
6. File is now 404

### Build Settings

```yaml
n/a
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the deployment sequence described: deploy a file, remove it, deploy again, then restore it with `amplitude publish -c --yes`. Investigate the redirect and file-availability behavior for the supplied App Id and region, and compare it with the linked amplify-cli issue. Done means the restored hashed file remains available without a redirect to a trailing-slash URL or a 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.