AWS Amplify White Screen Issue - reactjs

i have followed various links etc. i am able to publish to aws amplify but i get a white screen.
i am using vss, github and amplify.
i wrote the code
then
npm run build -g
git commit --all -m phil
git push
this is just the basic react app.
i get the following when i inspect the page
GET https://main.d3k27zedi0496.amplifyapp.com/static/js/main.a7eadf0b.js net::ERR_ABORTED 403
any help greatly appreciated
heres my asset-manifest.json on my build directory
{
"files": {
"main.css": "/static/css/main.073c9b0a.css",
"main.js": "/static/js/main.a7eadf0b.js",
"static/js/496.d68808b8.chunk.js": "/static/js/496.d68808b8.chunk.js",
"static/media/logo.svg": "/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg",
"index.html": "/index.html",
"main.073c9b0a.css.map": "/static/css/main.073c9b0a.css.map",
"main.a7eadf0b.js.map": "/static/js/main.a7eadf0b.js.map",
"496.d68808b8.chunk.js.map": "/static/js/496.d68808b8.chunk.js.map"
},
"entrypoints": [
"static/css/main.073c9b0a.css", "static/js/main.a7eadf0b.js" ] }``
`
heres my app.js
import logo from "./logo.svg";
import "./App.css";
` function App() {
return (
building Application
);
}
export default App;
heres my package.json (i have had it with and without the homepage line)
`{
"name": "workflow",
"version": "0.1.0",
"private": true,
"homepage": "https://main.d3k27zedi0496.amplifyapp.com",
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^14.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"reactstrap": "^9.1.5",
"web-vitals": "^3.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}``
this is my gitignore file
` # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
#amplify-do-not-edit-begin
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/logs
amplify/mock-data
amplify/mock-api-resources
amplify/backend/amplify-meta.json
amplify/backend/.temp
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json
amplifyconfiguration.json
amplifyconfiguration.dart
amplify-build-config.json
amplify-gradle-config.json
amplifytools.xcconfig
.secret-*
**.sample
#amplify-do-not-edit-end
`

I had a similar issue today and I resolved it by completely removing: "homepage": "{URL}" from my package.json and after that I got a strange access denied anytime I tried to navigate to my other pages and found that this solution in case 3 helped.
I hope this helps you.

Related

React js application isn't running on localhost:3000

I have tried many many times but my http://localhost:3000 not working at all.
Just taking reload & reload
Console log is also clear. nothing at there.
1st time when I faced this problem, I cleared the history, then it works but now this is not working,
After giving so much pressure, it shows me,"
Aw, Snap!
something went wrong while displaying this webpage.
"
my app.js file:
import './App.css';
function App() {
return (
<div className="App">
<h1>Hello World</h1>
</div>
);
}
export default App;
my package.json file:
{
"name": "secret-name",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.1.1",
"#testing-library/user-event": "^13.5.0",
"bootstrap": "^5.1.3",
"react": "^18.1.0",
"react-bootstrap": "^2.3.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Just the title of my website appears at the top.
I can't create a new react app because this is an assignment and I have pushed the primary code to the private repository. I don't want more problems.
After facing this problem, I deleted the package.lock.json & node_modules and then again install the packages by npm install.
What can I do now?
I think that something went wrong when you create the project.
Try to create a new one
npx create-react-app my_app_name
And the run
npm run start

Netlify is retuning a 404 when I upload my React application?

So I am uploading a single page client side react app on netlify. And I get a "404 page not found" message when I deploy it.
I have tried a _redirects file with /* /index.html 200 in the public folder, but that did not work
I tried changing the settings in build command to "CI= npm run build" , that also did not do anything other than cause another error saying "Command failed with exit code 254: CI= npm run build" so I edited it back the blank default value for the build command.
https://jolly-bhaskara-654af5.netlify.app/
https://github.com/moedeera/MySite2/tree/main/client
Here is my folder structure
client-----
|
|
Node_modules
package.json
package-lock.json
.gitignore
.readme
.src
.Public ----------
|
|
_redirects
index.html
manifest.json
robots.txt
favicon.ico
my package.json reads
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.15.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Can someone please help me understand what is going wrong and how can I deploy this properly ?

My react app appears blank after successfully deploying to github-pages

I'm trying to deploy a react app without any routing functionality. Just a single page app to github pages and everything worked successfully. I did'nt get any error while deploying but after deployment, the app is blank and when i check my console i see the following error
GET https://vicktor61.github.io/VickTor61/indecision-sniffle.git/static/css/main.aea680b0.chunk.css net::ERR_ABORTED 404
vicktor61.github.io/:1 GET https://vicktor61.github.io/VickTor61/indecision-sniffle.git/static/js/2.ed9a5867.chunk.js net::ERR_ABORTED 404
vicktor61.github.io/:1 GET https://vicktor61.github.io/VickTor61/indecision-sniffle.git/static/js/main.0913b291.chunk.js net::ERR_ABORTED 404
/VickTor61/indecision-sniffle.git/manifest.json:1 GET https://vicktor61.github.io/VickTor61/indecision-sniffle.git/manifest.json 404
manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.
I understand that the issue probably is because the gh-pages server could not get my files. But i still don't know why. please i will really appreciate a well detailed response.
This is my app link
https://vicktor61.github.io/indecision-sniffle/
and this is my package.json file
{
"homepage": "https://github.com/VickTor61/indecision-sniffle.git",
"name": "indecision-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"gh-pages": "^3.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-modal": "^3.14.3",
"react-scripts": "4.0.3",
"uniqid": "^5.3.0",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "yarn run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
And this is my github page where the whole app is hosted
https://github.com/VickTor61/indecision-sniffle/
As per the official docs, setting the homepage setting as follows in your package.json should fix the issue:
"homepage": ".",
In the docs it is stated:
This will make sure that all the asset paths are relative to
index.html. You will then be able to move your app from
http://mywebsite.com to http://mywebsite.com/relativepath or even
http://mywebsite.com/relative/path without having to rebuild it.
Guessing by the errors on the github page, the page is trying to load files which can't be found. I would say your homepage is wrong. It shouldn't be
"homepage": "https://github.com/VickTor61/indecision-sniffle.git",
it should be
"homepage": "https://vicktor61.github.io/indecision-sniffle",
as the page tries to load for example this file
https://vicktor61.github.io/VickTor61/indecision-sniffle.git/static/css/main.aea680b0.chunk.css
while it should be this file
https://vicktor61.github.io/indecision-sniffle/static/css/main.aea680b0.chunk.css

Blank page when deploying react-table on github pages

I am making simple react.js app using react-table.
I tried to run it locally using npm start and it is working fine.
But when I tried to deploy it on github pages, it just shows a blank page. I have followed all the steps for deploying react app on gh pages.
Here is the gh repository : https://github.com/7phalange7/react-table
the main branch has the project code, and gh-pages branch is deployed on github pages.
Should there be a problem deploying react-table on github pages ?
package.json for reference
{
"name": "react-table-example",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "^4.0.3",
"react-table": "^7.7.0",
"web-vitals": "^1.1.2",
"homepage": "https://7phalange7.github.io/react-table/"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^3.2.3"
}
}
Edit :
still not sure what is the issue here, but I copied all the code to a new react project and then deployed on github pages and it is working fine now. I guess since this was the first time deploying react project, somehow I messed up something.
try changing the private to 'false' in your package.json

Deploying React App To Github Pages Yields Manifest: Line: 1, column: 1, Syntax error

I am trying to host my react application in Github Pages.
I've done the same thing with a Vue based project, and had no issues, but with React, things are different.
I have gone over the following tutorials:
Tutorial #1
Tutorial #2
I am able to deploy the application to Github Pages, but am seeing the following error:
Manifest: Line: 1, column: 1, Syntax error.
Yes, my manifest is found inside my public folder and I do not know where the problem originates from.
I've tried reading various SO questions relating to this subject, but haven't found anything that is relevant.
I also tried creating a vanilla react project and following the tutorials, but got the same issues.
This is my package.json file:
{
"name": "Random App Name",
"homepage": "https://github.com/TomerPacific/projectName",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^3.1.0"
}
}
What is happening here? Is the problem a configuration issue?
Thanks to #Kibonge Murphy's suggestion, I checked the request url for all the network requests being made and found out that it was wrong.
Instead of having the URL of the Github page as the homepage key in the package.json file, I put in the URL of the repository.
Meaning,
I should have put this : https://tomerpacific.github.io/projectName/
Instead of https://github.com/TomerPacific/projectName
In my case this error was caused by the fact that the server sent a 404 error page instead of the manifest. In the sources tab of Chrome dev tools click on the file that is your manifest and confirm it's not a error page.

Resources