aws-amplify / aws-amplify/amplify-hosting
Next.js rewrites not working on amplify
- 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
d29xyyagv8f0bn
### AWS Region
us-west-2
### Amplify Hosting feature
Not Applicable
### Frontend framework
Next.js
### Next.js version
13.2.1
### Next.js router
Pages Router
### Describe the bug
The rewrites in `next.config.js` are not working properly. I get a 404 when accessing pages that are normally accessible locally but not when deployed to amplify.
### Expected behavior
I expect "/" to load the static homepage "/terms" to load the terms page and "/privacy" to load the privacy page. However, right now it is 404ing. I have even rolled back my amplify build to a previous bulid that worked before and still having the same issue.
### Reproduction steps
Visit www.gobacknforth.com and notice that it 404s. If you check the `next.config.js` you'll see the rewrite for "/" is set up properly.
### Build Settings
_No response_
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
Contributor guide
Research direction
Start by inspecting the deployed site at www.gobacknforth.com and the rewrite configuration in next.config.js, then compare the Amplify deployment with local behavior. Check the missing build settings and logs to determine why /, /terms, and /privacy return 404; done means those routes load successfully on the deployed site.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, next.js
- Domain
- cloud, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100