React app keep crashing on heroku / node.js - reactjs

2020-07-21T14:16:10.473788+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=reacthelloworld.herokuapp.com request_id=e53b2e2b-48a5-4251-844a-ebb4c202cad7 fwd="65.92.155.165" dyno= connect= service= status=503 bytes= protocol=https
2020-07-21T14:16:13.905886+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=reacthelloworld.herokuapp.com request_id=6a6143e4-0d01-4127-981e-b1652f909441 fwd="65.92.155.165" dyno= connect= service= status=503 bytes= protocol=https
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
Find out more about deployment here:
bit.ly/CRA-deploy
-----> Caching build
- node_modules
-----> Pruning devDependencies
audited 1646 packages in 12.038s
62 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
Build succeeded!
-- Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
Compressing...
Done: 59.7M
-- Launching...
Released v3
https://reacthelloworld.herokuapp.com/ deployed to Heroku
I know it could be few things all over but I think heroku is not recognizing the path, I did deployed apps before but had to change the computer and re install node all over, at this point need an advice please

I think you are trying to host your React app on Heroku.
If that's the case, you can build React locally and upload static files to Heroku (this can help).
Or if you are trying to host your Node.js app which has React frontend, you should build the React app first and upload the Node.js app with it to Heroku. Heroku provides Node.js environment.
EDIT:
It turns out that npm/yarn was the issue.
Using yarn resolves the error.

Related

How to deploy a Golang/mongodb/react app on heroku?

I am trying to figure out how to deploy a Golang/mongodb/react app on heroku, but I have never done it so I am kind of clueless on how to do it. I have made its own project and added the config vars that are on my .env, it has a heroku/go buildpack, but every time I do
git push heroku main
I get this on the terminal:
Enumerating objects: 788, done.
Counting objects: 100% (788/788), done.
Delta compression using up to 8 threads
Compressing objects: 100% (728/728), done.
Writing objects: 100% (775/775), 2.16 MiB | 779.00 KiB/s, done.
Total 775 (delta 395), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/go
remote: -----> Go app detected
remote: -----> Fetching stdlib.sh.v8... done
remote: ----->
remote: Detected go modules via go.mod
remote: ----->
I don't think it is giving me an error there, but if I click on open-app from heroku I get an Application error message and asks me to use
heroku logs --tail
And it shows me a bunch of these lines which I can't really understand:
2021-10-08T15:00:03.362868+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=OPTIONS path="/profile?id=615affc23cc365e3ac6cee23" host=twitter-clone-jeff.herokuapp.com request_id=58a7c915-4543-4105-95f2-063604a6e7c8 fwd="108.215.249.255" dyno= connect= service= status=503 bytes= protocol=https
2021-10-08T15:00:03.464879+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=OPTIONS path="/profile?id=615affc23cc365e3ac6cee23" host=twitter-clone-jeff.herokuapp.com request_id=2f1e17e0-3c38-4d4b-9e34-5e4a8f27afcd fwd="108.215.249.255" dyno= connect= service= status=503 bytes= protocol=https
And it finally shows me this:
037bc7735b fwd="108.215.249.255" dyno= connect= service= status=503 bytes= protocol=https
2021-10-08T15:13:02.688268+00:00 app[api]: Set MONGO_PASSWORD config vars by user jeffersongarcia1599#gmail.com
2021-10-08T15:13:02.688268+00:00 app[api]: Release v7 created by user jeffersongarcia1599#gmail.com
2021-10-08T15:13:02.943260+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-08T15:13:03.660069+00:00 heroku[web.1]: Starting process with command `bin/Twitter-Clone`
2021-10-08T15:13:04.507378+00:00 app[web.1]: 2021/10/08 15:13:04 Error loaging your .env file
2021-10-08T15:13:04.624983+00:00 heroku[web.1]: Process exited with status 1
2021-10-08T15:13:04.678311+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-08T15:13:16.067630+00:00 app[api]: Set MY_SECRET config vars by user jeffersongarcia1599#gmail.com
2021-10-08T15:13:16.067630+00:00 app[api]: Release v8 created by user jeffersongarcia1599#gmail.com
2021-10-08T15:13:16.408304+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-08T15:13:17.103362+00:00 heroku[web.1]: Starting process with command `bin/Twitter-Clone`
2021-10-08T15:13:18.191933+00:00 app[web.1]: 2021/10/08 15:13:18 Error loaging your .env file
2021-10-08T15:13:18.347637+00:00 heroku[web.1]: Process exited with status 1
2021-10-08T15:13:18.402108+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-08T15:13:35.119252+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=twitter-clone-jeff.herokuapp.com request_id=133bbf4e-3dcc-44ab-ad9b-2d301868c166 fwd="108.215.249.255" dyno= connect= service= status=503 bytes= protocol=https
2021-10-08T15:20:10.885717+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=twitter-clone-jeff.herokuapp.com request_id=ac8ed7a8-1137-45b8-952d-3ecea81ee645 fwd="108.215.249.255" dyno= connect= service= status=503 bytes= protocol=https
2021-10-08T15:30:38.792946+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=twitter-clone-jeff.herokuapp.com request_id=fb4bc339-5b4b-4ae2-896d-9f07f87cc16d fwd="108.215.249.255" dyno= connect= service= status=503 bytes= protocol=https
Any help would be appreciated as I am honestly clueless since the git push heroku main does not really show any errors. I know that for Postgress databases there is like a Heroku Postgres add on, but I don't if there is a Mongo one. I have a SECRET_KEY and MONGO_PASSWORD on a .env but I also put them on the config vars. Thanks in advance! My repo in case necessary
https://github.com/JeffersonGarcia15/Twitter-Clone

React application & GraphQl server deployment problem with Heroku

I made a react application that works with a prisma - graphql server. The server is located inside the react application. I want to deploy it with Heroku (first time ever using it). When I deploy to Heroku I get this error when I run heroku logs --tail
020-06-12T14:10:04.296156+00:00 heroku[web.1]: Process exited with status 0
2020-06-12T14:10:04.332716+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-12T14:10:04.335407+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-12T14:10:15.424387+00:00 heroku[web.1]: Starting process with command `npm start`
2020-06-12T14:10:17.947363+00:00 app[web.1]:
2020-06-12T14:10:17.947379+00:00 app[web.1]: > business-scheduler#0.1.0 start /app
2020-06-12T14:10:17.947379+00:00 app[web.1]: > react-scripts start
2020-06-12T14:10:17.947379+00:00 app[web.1]:
2020-06-12T14:10:20.724920+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.19.52.78/
2020-06-12T14:10:20.725386+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-06-12T14:10:20.725577+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-06-12T14:10:20.725681+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-06-12T14:10:20.725971+00:00 app[web.1]: Starting the development server...
2020-06-12T14:10:20.725972+00:00 app[web.1]:
2020-06-12T14:10:20.803624+00:00 heroku[web.1]: Process exited with status 0
2020-06-12T14:10:20.835709+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-12T14:27:07.241917+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=appoint-scheduler.herokuapp.com request_id=4a6d7846-488a-4a57-bd76-ee5b84c197fc fwd="94.227.127.41" dyno= connect= service= status=503 bytes= protocol=https
2020-06-12T14:27:07.688859+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=appoint-scheduler.herokuapp.com request_id=83928da3-bc4a-44f5-83fb-66a7c5b2611d fwd="94.227.127.41" dyno= connect= service= status=503 bytes= protocol=https
I am using yarn not npm on my project does anyone know what I need to do to be able to deploy my project?
Because my project is not running on heroku because I get this when trying to open the deployed version
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I think the issue is that you're trying to start the react development server on heroku. Your react app should be served as a static js bundle which is generated after you run the production build cmd npm run build.
Have a look at https://github.com/mars/create-react-app-buildpack which is developed for this usecase only and makes it much easier.
If you're trying to deploy the whole stack ( react + prisma + graphql server )...take a look at this post which covers it in detail.
Hope this helps !

React App deploying but not running in heroku

Thank you in advance for any help with this issue, i have been trying to solve it for some hours now...
I have created a react app with create-react-app and it's running fine in the local server, deployed it to heroku and it deployed sucessfully, but it does not open.
When i do heroku logs --tail i get the bellow errors:
2020-04-23T15:32:00.547380+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.16.17.130/
2020-04-23T15:32:00.547959+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-04-23T15:32:00.548051+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-04-23T15:32:00.548120+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-04-23T15:32:00.548312+00:00 app[web.1]: Starting the development server...
2020-04-23T15:32:00.548312+00:00 app[web.1]:
2020-04-23T15:32:00.680072+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-23T15:32:01.946329+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=portfolio-carlosamorim.herokuapp.com request_id=3c71f08a-4492-40b7-bb6c-82055d05f0bd fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T15:32:02.587450+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=portfolio-carlosamorim.herokuapp.com request_id=3a20431f-789e-4da8-a151-438205b055e9 fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T15:33:23.144950+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=portfolio-carlosamorim.herokuapp.com request_id=d043557d-ed3f-474a-ba84-0d14c2ac2696 fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T15:33:23.414482+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=portfolio-carlosamorim.herokuapp.com request_id=f612d864-2e2e-4669-a33d-9b5edb23732d fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
My package.json :
https://github.com/CarlosAmorimProjects/portfolio/blob/master/package.json
Anyone experienced and solved the same issue ?
Thank you
Update :
I was able to deploy it and it's running at Vercel.com, i used buildpack create-react-app and it's working perfectly, i cannot apply that same builpack on heroku.
I suspect the problem is related to that.
The default buildpack when deploying is that of node.js. You needed to use the create-react-app buildpack (as seen below).
heroku create $APP_NAME --buildpack mars/create-react-app
git push heroku master
heroku open
helpfull link: https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo

React project hosted in heroku fails when open

So deployed a React project to heroku using bitbucket pipelines that is working well, but now can't seem to make heroku to open the project don't have the script npm start in my package.json and what is recommend is to create a file Procfile that is a txt and inside have
web: index.html
in my webpack:
entry: {
bundle: './src/index.js'
},
output: {
publicPath : '/',
path: path.resolve(__dirname,'build'),
filename: '[name].[chunkhash].js'
},
and in package.json
"scripts": {
"heroku-prebuild": "npm install --only=dev",
"clean": "rimraf build",
"build": "npm run clean && webpack -p",
"serve": "webpack-dev-server --progress --colors"
},
in the heroku logs getting:
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
host=projectname.herokuapp.com
request_id=a2bc33da-f938-4d7b-9395-b40442f9b2c0 fwd="88.157.88.35"
dyno= connect= service= status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/favicon.ico" host=projectname.herokuapp.com
request_id=b2de2bdf-528e-4f97-9fe9-7f313e025ebd fwd="88.157.88.35"
dyno= connect= service= status=503 bytes= protocol=https
Not using the create-react-app and if possible didn't want to add node express to point to the react project https://blog.bitsrc.io/react-production-deployment-part-3-heroku-316319744885
So do I need to point to build/index.html in Procfile?? or is it some other way all the examples have seen are about create-react-app and node express....
Was able to find the solution in the following blog where as stated the heroku runs by default npm start command if the Procfile is missing or add in the Procfile the line web: npm start and as stated in the blog the start command in package.json runs serve -s build where the serve is a package to point the build folder where is located the bundle and the index.html file and now it already works well. Heroku should have a default option to point to a default folder.. but all attemps that had tried failed... so thanks for #Bernard Bado and his blog for pointing to the solution.

Application fails to run on Heroku

I have NodeJs application with yeoman, grunt, bower installed. I generatedm angularjs app using yeomen. Local version of application runs with no problem by typing grunt serve. Moreover application was successfully deployed to Heroku by grunt deploy link. When trying to access application on heroku it shows:
Application Error An error occurred in the application and your page
could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
In application log (Heroku dashboard > Activity):
Deployed
Build succeeded
-----> Node.js app detected
-----> Reading application state
package.json...
build directory...
cache directory...
environment variables...
Node engine: >=0.10.0
Npm engine: unspecified
Start mechanism: Procfile
node_modules source: package.json
node_modules cached: true
NPM_CONFIG_PRODUCTION=true
NODE_MODULES_CACHE=true
-----> Installing binaries
Resolving node version >=0.10.0 via semver.io...
Downloading and installing node 0.10.35...
Using default npm version: 1.4.28
-----> Building dependencies
Restoring node modules from cache
Pruning unused dependencies
npm WARN package.json nodejsw3#0.0.0 No repository field.
Installing any new modules
npm WARN package.json nodejsw3#0.0.0 No repository field.
-----> Checking startup method
Found Procfile
-----> Finalizing build
Creating runtime environment
Exporting binary paths
Cleaning npm artifacts
Cleaning previous cache
Caching results for future builds
-----> Build succeeded!
nodejsw3#0.0.0 /tmp/build_9b26539892553ae79f16e539e2f083e0
????????? (empty)
WARNING: Avoid semver ranges starting with '>' in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
-----> Discovering process types
Procfile declares types -> web
-----> Compressing... done, 6.8MB
-----> Launching... done, v9
https://myapp.herokuapp.com/ deployed to Heroku
Project structure:
Log
2015-02-07T17:49:56.504866+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=myapp.herokuapp.com request_id=257d316d-98
d1-4d21-a170-7c27e42b907e fwd="10.10.10.11" dyno= connect= service= status=503
bytes=
2015-02-07T17:49:57.762152+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=
f109ba40-e921-486a-a79a-7a7d842705a7 fwd="10.10.10.11" dyno= connect= service=
status=503 bytes=
2015-02-07T17:53:40.155437+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=myapp.herokuapp.com request_id=7e0e784c-0e
76-48b1-ad3e-bbf74b400e31 fwd="10.10.10.11" dyno= connect= service= status=503
bytes=
2015-02-07T17:53:41.454002+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=
4d56eacf-5515-48e4-9b5d-34ccc4c4457e fwd="10.10.10.11" dyno= connect= service=
status=503 bytes=
2015-02-07T17:54:20.109125+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=myapp.herokuapp.com request_id=b244e431-81
d6-4f82-a0e0-1e845a45a449 fwd="10.10.10.11" dyno= connect= service= status=503
bytes=
2015-02-07T17:54:21.286203+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=
e2c7d762-a88c-49f6-a15b-e1768e7310d5 fwd="10.10.10.11" dyno= connect= service=
status=503 bytes=
2015-02-07T17:57:14.924093+00:00 heroku[web.1]: State changed from crashed to st
arting
2015-02-07T17:57:16.809601+00:00 heroku[web.1]: Starting process with command `n
ode index.js`
2015-02-07T17:57:18.731681+00:00 app[web.1]: module.js:340
2015-02-07T17:57:18.736235+00:00 app[web.1]: at Function.Module._resolveFile
name (module.js:338:15)
2015-02-07T17:57:18.736237+00:00 app[web.1]: at Function.Module._load (modul
e.js:280:25)
2015-02-07T17:57:18.736241+00:00 app[web.1]: at require (module.js:380:17)
2015-02-07T17:57:18.736243+00:00 app[web.1]: at Object.<anonymous> (/app/ind
ex.js:1:77)
2015-02-07T17:57:18.732015+00:00 app[web.1]: throw err;
2015-02-07T17:57:18.736244+00:00 app[web.1]: at Module._compile (module.js:4
56:26)
2015-02-07T17:57:18.731200+00:00 app[web.1]:
2015-02-07T17:57:18.732021+00:00 app[web.1]: ^
2015-02-07T17:57:18.736232+00:00 app[web.1]: Error: Cannot find module 'express'
2015-02-07T17:57:18.736239+00:00 app[web.1]: at Module.require (module.js:36
4:17)
2015-02-07T17:57:18.736246+00:00 app[web.1]: at Object.Module._extensions..j
s (module.js:474:10)
2015-02-07T17:57:18.736247+00:00 app[web.1]: at Module.load (module.js:356:3
2)
2015-02-07T17:57:18.736249+00:00 app[web.1]: at Function.Module._load (modul
e.js:312:12)
2015-02-07T17:57:18.736251+00:00 app[web.1]: at Function.Module.runMain (mod
ule.js:497:10)
2015-02-07T17:57:19.580364+00:00 heroku[web.1]: Process exited with status 8
2015-02-07T17:57:19.592340+00:00 heroku[web.1]: State changed from starting to c
rashed

Resources