amplify-cli: Amplify console is not building my react frontend code correctly ?
Describe the bug
I had created a react project and integrated with Amplify cli . With Amplify cli i had i configured auth and storage and then i pushed to codecommit repo . With Amplify console i integrated my codecommit and deployed react app. First time when deploying it had triggered buildspec.yml which has frontend commands after i had made some little tweaks in the my frontend code and pushed it again. The tweaks were : i added react-router-dom@5.0.0 dependency and used it for routing my react-app components. This time amplify console completed the whole process without any error, but when i went into the react-app i found my routes were not working properly means when i clicked on the page1 button instead of routing to /page1 it is appending /index.html at the end of amplifyconsole url. Just to test whether my react-app is correct or not i used amplify add hosting and kept it in S3 . It had worked perfectly in S3 http hosting.
To Reproduce Steps to reproduce the behavior:
- Create a react app locally and commit it to
codecommitrepo. - Integrated
codecommitrepo withAmplify Console. - Then made changes to your react app by enabling
routesusingreact-router-domand push it again(All the changes that i had did is in this githubrepository
Expected behavior When clicking on the navbar it need to route to me to a different page but it is not.
Screenshots
My Amplify Console process completed screenshot

React-app Navigation bar when ran locally : When clicked on page 1 it routes to page 1 component.

React-app Navigation bar when ran locally: When clicked on page 2 it routes to page 2 component.

Desktop (please complete the following information):
- Windows
- Browser [e.g. chrome]
- amplify cli version – 0.1.36
Let me know if any further information is needed from my side.
Any help is appreciated Thanks
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (3 by maintainers)
@Private-SO Can you please try adding the following rewrite rule to your application: