aws-amplify / aws-amplify/amplify-hosting

Rewriting to 404 page in Gatsby.js causes 500 error.

Open
#3,293 1 comment 2 reactions 0 assignees View on GitHub
bug hosting pending-triage
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

private at this stage - happy to share in private message

### AWS Region

ap-northeast-1

### Amplify Hosting feature

Redirects

### Describe the bug

In the Gatsby.js Rewrite and Redirect settings, the rewrite to a 404 page worked fine until now, but recently I've been getting an `Internal Server Error: target response exceeds 1MB limit.` It's not displaying properly. I changed the rewrite setting to redirect and it worked, but I don't know why, so please let me know.

### Expected behavior

Successful rewrite to 404 screen.

### Reproduction steps

Add the following to Amplify's rewrite and redirect settings.
1. source address:`/<*>` target address:`/404/index.html` input:`404(rewrite)`
2. Create `pages/404.tsx` on the Gatsby side.
3. 500 error occurs when deploying to Amplify.

### Build Settings

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Amplify Hosting rewrite/redirect settings and the Gatsby `pages/404.tsx` file named in the reproduction steps. Reproduce using the `/<*>` to `/404/index.html` rewrite and inspect the deployment response for the reported 1MB limit error. Done means rewriting to the 404 page succeeds without returning a 500 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.