Open bamne123 opened 6 years ago
I added a troubleshoot section for Heroku yesterday: https://www.robinwieruch.de/graphql-apollo-server-tutorial/ Can you check if one of the two tips helps you?
Thanks for reply, i am stuck at running Client and Server concurrently on Heroku. Struggling with node Scripts to run application after deploy.
Do heroku config:set NPM_CONFIG_PRODUCTION=false YARN_PRODUCTION=false
on the command line and try to push again to Heroku.
Just to make sure, don't forget to add the introspection flag:
const server = new ApolloServer({
introspection: true,
typeDefs: schema,
resolvers,
...
});
@bamne123 did this help you?
@rwieruch, I did not want to create an extra issue for this but I had to add playground: true
in addition to introspection: true
to get the playground on Heroku.
Thanks for mentioning @devserkan I will add it to the book!
You are welcome @rwieruch. I thank you for this excellent book.
Fixed https://github.com/the-road-to-graphql/fullstack-apollo-express-postgresql-boilerplate/commit/8dcea82b3013d1b9bc47bac897140563eb62b4e2 but I keep this open for people who stumble on these issues.
If anyone is running into this issue, just leave a quick comment here so that I know that this is still relevant.
@rwieruch, I get these errors when I try to run the app on heroku.
2019-01-21T21:15:11.704553+00:00 app[web.1]: > nodemon --exec babel-node src/index.js
2019-01-21T21:15:11.704554+00:00 app[web.1]:
2019-01-21T21:15:11.709131+00:00 app[web.1]: sh: 1: nodemon: not found
2019-01-21T21:15:11.712583+00:00 app[web.1]: npm ERR! file sh
2019-01-21T21:15:11.712975+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-01-21T21:15:11.713223+00:00 app[web.1]: npm ERR! errno ENOENT
2019-01-21T21:15:11.713463+00:00 app[web.1]: npm ERR! syscall spawn
2019-01-21T21:15:11.714477+00:00 app[web.1]: npm ERR! node-babel-server@1.0.0 start: nodemon --exec babel-node src/index.js
2019-01-21T21:15:11.714642+00:00 app[web.1]: npm ERR! spawn ENOENT
2019-01-21T21:15:11.714914+00:00 app[web.1]: npm ERR!
2019-01-21T21:15:11.715119+00:00 app[web.1]: npm ERR! Failed at the node-babel-server@1.0.0 start script.
2019-01-21T21:15:11.715321+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-01-21T21:16:09.062950+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=graphql-server-postgres.herokuapp.com request_id=9413ec21-bbb0-4e7c-b6d0-7d8dfd34033c fwd="108.171.131.178" dyno= connect= service= status=503 bytes= protocol=https
2019-01-21T21:16:09.216830+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=graphql-server-postgres.herokuapp.com request_id=6d2c0c2b-a331-4f40-81bf-dd502b7be895 fwd="108.171.131.178" dyno= connect= service= status=503 bytes= protocol=https
2019-01-21T21:18:33.450913+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=graphql-server-postgres.herokuapp.com request_id=0d4b00f5-3380-4d70-a185-b2d8d7643aff fwd="108.171.131.178" dyno= connect= service= status=503 bytes= protocol=https
2019-01-21T21:28:35.466808+00:00 heroku[web.1]: Starting process with command npm start
2019-01-21T21:28:38.549935+00:00 heroku[web.1]: State changed from starting to crashed
2019-01-21T21:28:38.529644+00:00 heroku[web.1]: Process exited with status 1
2019-01-21T21:51:24.055760+00:00 heroku[web.1]: State changed from crashed to starting
I think this is caused because my server folder isn't at the root level and the script is trying to run the npm start on the index.js file from root level not the /server/src folder? I'm not sure why it isn't working though I don't know anything about heroku or much about builds. I have set introspection and npm config production = false as well as yarnproduction = false.
Any ideas what could be going wrong? Also, I setup heroku project within the /server file not root level. I also tried it from root level and neither work. Here is my project as it's currently setup on github. https://github.com/tmstani23/node-apollo-postgres-fullstack-app
@tmstani23 Hm, my suggestion would have been to try it with your project at the root level. But if this didn't work, I don't know if Heroku changed something again. Maybe try to clone this repository to your machine and deploy it to Heroku. If this doesn't work as well, there is a bug again.
I got it working! I had to move all the files into the root level. I removed the server folder so now it's root and src folder only. I also had to install nodemon as dev dependency using npm install nodemon --save-dev
Not able to deploy on heroku, Did anyone tried?