Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deploy on heroku? [Help Wanted.] #37

Open
bamne123 opened this issue Nov 1, 2018 · 13 comments · May be fixed by #54
Open

How to deploy on heroku? [Help Wanted.] #37

bamne123 opened this issue Nov 1, 2018 · 13 comments · May be fixed by #54

Comments

@bamne123
Copy link

bamne123 commented Nov 1, 2018

Not able to deploy on heroku, Did anyone tried?

@rwieruch
Copy link
Member

rwieruch commented Nov 2, 2018

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?

@bamne123
Copy link
Author

bamne123 commented Nov 2, 2018

Thanks for reply, i am stuck at running Client and Server concurrently on Heroku. Struggling with node Scripts to run application after deploy.

@rwieruch
Copy link
Member

rwieruch commented Nov 2, 2018

Do heroku config:set NPM_CONFIG_PRODUCTION=false YARN_PRODUCTION=false on the command line and try to push again to Heroku.

@rwieruch
Copy link
Member

rwieruch commented Nov 2, 2018

Just to make sure, don't forget to add the introspection flag:

const server = new ApolloServer({
  introspection: true,
  typeDefs: schema,
  resolvers,
  ...
});

@rwieruch
Copy link
Member

rwieruch commented Nov 6, 2018

@bamne123 did this help you?

@devserkan
Copy link

@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.

@rwieruch
Copy link
Member

Thanks for mentioning @devserkan I will add it to the book!

@devserkan
Copy link

You are welcome @rwieruch. I thank you for this excellent book.

@rwieruch
Copy link
Member

Fixed 8dcea82 but I keep this open for people who stumble on these issues.

@rwieruch rwieruch added the wontfix This will not be worked on label Dec 17, 2018
@rwieruch
Copy link
Member

If anyone is running into this issue, just leave a quick comment here so that I know that this is still relevant.

@rwieruch rwieruch removed the wontfix This will not be worked on label Jan 16, 2019
@tmstani23
Copy link

tmstani23 commented Jan 22, 2019

@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

@rwieruch
Copy link
Member

rwieruch commented Jan 24, 2019

@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.

@tmstani23
Copy link

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

@morenoh149 morenoh149 linked a pull request Feb 21, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants