Help for Lift-off part 5, Deploy Branch

Hi guys, I tried to Deploying Apollo server, and I make all tasks, deploy branch, but for some reason, I have this Error.

Application error

The log is

2021-11-03T22:03:18.932304+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2021-11-03T22:03:18.935225+00:00 app[web.1]:

2021-11-03T22:03:18.935295+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:

2021-11-03T22:03:18.935331+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-11-03T22_03_18_932Z-debug.log

2021-11-03T22:03:19.056438+00:00 heroku[web.1]: Process exited with status 1

2021-11-03T22:03:19.219663+00:00 heroku[web.1]: State changed from starting to crashed

2021-11-03T22:03:31.268548+00:00 heroku[router]: at=error code=H10 desc=ā€œApp crashedā€ method=GET path=ā€œ/ā€ host=server-catstronauts-hg.herokuapp.com request_id=1b99127e-b196-43c0-9a24-a93a6beb5e67 fwd=ā€œ45.236.29.99ā€ dyno= connect= service= status=503 bytes= protocol=https

If you can help me I really appreciate it.

Ups!!! I fixed :wink:

In the index.js file, I did still have my configuration to apollo studio

require(ā€œdotenvā€).config();

Delete this line and now work

I read carefully the course and find this, Heroku sets the NODE_ENV environment variable to production.

Thanks anyway guys, I hope this post helps someone

Glad youā€™ve got it working @hendridg! And congrats on completing the Lift-off series :smiley:

I also had this problem. First I added ā€œenginesā€ in the package.json file cause I thought it will solve the problem, but it didnā€™t.
example: ā€œenginesā€:{ā€œnodeā€: ā€œv14.17.5ā€, ā€œnpmā€: ā€œ7.24.2ā€}

then, I tried to remove the authorā€™s name (which is a huge problem on my part because I am not the original Author of the app. Itā€™s kind of piracy for me, not putting the real author.).

But the deployment worked after I removed the original author ā€œRaphael Terrier @R4ph-tā€ 's name in the package.json file. I didnā€™t add my name so itā€™s authorless, sorry Raphael.

(I donā€™t know if this problem was herokuā€™s end or my githubā€™s securityā€™s end). Just sharing my thoughts.

Thanks for sharing @jobdecrypt ! Curious if this was for both the client and server repos where you made this change?

Iā€™m experiencing this issue as well, for the server (havenā€™t yet deployed client). Iā€™ve removed the author name, to no avail. And, my fork does not include require(ā€œdotenvā€).config();. Not sure whatā€™s happening. Iā€™ve also tried both a yarn.lock and package-lock.json, still hitting the Heroku application error. See the repo here: GitHub - amunrarara/odyssey-lift-off-part5-server: Odyssey Lift-off V - Server - Course Companion App

Hereā€™s my logs:

2022-04-06T11:04:38.902679+00:00 app[web.1]:     at Object.<anonymous> (/app/src/index.js:25:1)
2022-04-06T11:04:38.902679+00:00 app[web.1]:     at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-06T11:04:38.902680+00:00 app[web.1]:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-06T11:04:38.902680+00:00 app[web.1]:     at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-06T11:04:38.902680+00:00 app[web.1]:     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-04-06T11:04:39.102082+00:00 heroku[web.1]: Process exited with status 1
2022-04-06T11:04:39.973504+00:00 heroku[web.1]: State changed from starting to crashed
2022-04-06T11:04:41.090754+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=apollo-odyssey-tutorial.herokuapp.com request_id=ff7d7c20-351f-4306-8ea7-acabf4ca3d52 fwd="73.11.15.74" dyno= connect= service= status=503 bytes= protocol=https
2022-04-06T11:04:41.964284+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=apollo-odyssey-tutorial.herokuapp.com request_id=7bc63974-e0a9-44f4-a97f-6e3ec9a69155 fwd="73.11.15.74" dyno= connect= service= status=503 bytes= protocol=https
2022-04-06T11:06:03.416209+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=OPTIONS path="/" host=apollo-odyssey-tutorial.herokuapp.com request_id=8d627485-cf9e-463d-a918-36e0a2e692d0 fwd="73.11.15.74" dyno= connect= service= status=503 bytes= protocol=https

Hello @amunrarara , have you added the environment variables to your app in the heroku dashboard? If so, could you please paste here the key names (like APOLLO_KEY, not the values) you used?
Thank you!

I have the following:
APOLLO_GRAPH_REF
APOLLO_GRAPH_VARIANT
APOLLO_KEY
APOLLO_SCHEMA_REPORTING

It seems that, by removing APOLLO_GRAPH_VARIANT, the app properly builds!

I used this environment variable because it was stated in your tutorial. But, I wasnā€™t provided the value by Apollo Studio when I registered the schema, I copied that key/value from the tutorial directly.

Find it here: Registering our schema | Lift-off V: Production & the Schema Registry | Apollo Odyssey

Also to note, Apollo Studio says here ā€˜ā€¦four environment variablesā€™, but only gives three. This increased my belief that I needed the additional variable showed in the tutorial.

Thanks for sending that over @amunrarara .
The snippets with variables in studio changed since we created the tutorial.
APOLLO_GRAPH_REF in now the default from studio, which is compounding ID and VARIANT like so: APOLLO_GRAPH_ID@APOLLO_GRAPH_VARIANT . Using APOLLO_GRAPH_ID and APOLLO_GRAPH_VARIANT still works, but using both REF and VARIANT variables together was what made it fail.
Sorry for the confusion, weā€™ll be updating the tutorial and the description snippets in studio to state 3 variables and not 4 shortly.

Thank you for learning with us!
Best,
Raph

1 Like

Heroku is currently not allowing Github integration (Heroku Status) so most of the Lift-Off 5 work needs to be completed using some other service - FYI

Hi @boggsey! Thank you so much for bringing this to our attention!

It looks like there are no updates on Herokuā€™s side on when they expect the GitHub integration to be fixed, so weā€™ve gone ahead and added a few notes in Lift-off V detailing alternate instructions for deployment using the Heroku CLI. This change should be live shortly!

1 Like

Hi all, Iā€™m experiencing this same error but with the client app. The server app is up and running in prod, no issues. I followed the instructions with client, replaced the apollo client uri with my prod server, and deployment succeeds. But I get the same app error as pictured up top, in the inspector itā€™s a 503 for the client url and the favicon.

Complete heroku logs:

2022-04-21T02:11:36.482152+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watcherManager.js
2022-04-21T02:11:36.482152+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watchpack.js
2022-04-21T02:11:36.482152+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeWatchFileSystem.js
2022-04-21T02:11:36.482153+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
2022-04-21T02:11:36.482153+00:00 app[web.1]: - /app/node_modules/webpack/lib/webpack.js
2022-04-21T02:11:36.482153+00:00 app[web.1]: - /app/node_modules/react-scripts/scripts/start.js
2022-04-21T02:11:36.482153+00:00 app[web.1]: chokidar@2: Error: Cannot find module 'watchpack-chokidar2'
2022-04-21T02:11:36.482154+00:00 app[web.1]: Require stack:
2022-04-21T02:11:36.482154+00:00 app[web.1]: - /app/node_modules/watchpack/lib/chokidar.js
2022-04-21T02:11:36.482154+00:00 app[web.1]: - /app/node_modules/watchpack/lib/DirectoryWatcher.js
2022-04-21T02:11:36.482154+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watcherManager.js
2022-04-21T02:11:36.482154+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watchpack.js
2022-04-21T02:11:36.482155+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeWatchFileSystem.js
2022-04-21T02:11:36.482155+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
2022-04-21T02:11:36.482155+00:00 app[web.1]: - /app/node_modules/webpack/lib/webpack.js
2022-04-21T02:11:36.482155+00:00 app[web.1]: - /app/node_modules/react-scripts/scripts/start.js
2022-04-21T02:11:36.482155+00:00 app[web.1]: 
2022-04-21T02:11:36.482155+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/watchpack/lib/chokidar.js:17:7)
2022-04-21T02:11:36.482156+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-21T02:11:36.482156+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-21T02:11:36.482156+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-21T02:11:36.482156+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-04-21T02:11:36.482157+00:00 app[web.1]: at Module.require (node:internal/modules/cjs/loader:1005:19)
2022-04-21T02:11:36.482157+00:00 app[web.1]: at require (node:internal/modules/cjs/helpers:102:18)
2022-04-21T02:11:36.482157+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/watchpack/lib/DirectoryWatcher.js:9:16)
2022-04-21T02:11:36.482157+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-21T02:11:36.482158+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-21T02:11:36.501058+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=bb-client-catstronauts.herokuapp.com request_id=513e2019-23d8-4bda-915f-b0bdd37239bd fwd="68.175.91.109" dyno=web.1 connect=0ms service=22831ms status=503 bytes=0 protocol=https
2022-04-21T02:11:36.617318+00:00 heroku[web.1]: Process exited with status 1
2022-04-21T02:11:36.739539+00:00 heroku[web.1]: State changed from up to crashed
2022-04-21T02:11:36.748866+00:00 heroku[web.1]: State changed from crashed to starting
2022-04-21T02:11:48.629255+00:00 heroku[web.1]: Starting process with command `npm start`
2022-04-21T02:11:50.571642+00:00 app[web.1]: 
2022-04-21T02:11:50.571650+00:00 app[web.1]: > catstronauts-client-complete@1.0.0 start
2022-04-21T02:11:50.571650+00:00 app[web.1]: > react-scripts start
2022-04-21T02:11:50.571651+00:00 app[web.1]: 
2022-04-21T02:11:55.651474+00:00 app[web.1]: ā„¹ ļ½¢wdsļ½£: Project is running at http://172.16.40.166/
2022-04-21T02:11:55.651868+00:00 app[web.1]: ā„¹ ļ½¢wdsļ½£: webpack output is served from
2022-04-21T02:11:55.652075+00:00 app[web.1]: ā„¹ ļ½¢wdsļ½£: Content not from webpack is served from /app/public
2022-04-21T02:11:55.655978+00:00 app[web.1]: ā„¹ ļ½¢wdsļ½£: 404s will fallback to /
2022-04-21T02:11:55.656449+00:00 app[web.1]: Starting the development server...
2022-04-21T02:11:55.656449+00:00 app[web.1]: 
2022-04-21T02:11:55.994027+00:00 heroku[web.1]: State changed from starting to up
2022-04-21T02:11:56.182318+00:00 app[web.1]: Browserslist: caniuse-lite is outdated. Please run:
2022-04-21T02:11:56.182330+00:00 app[web.1]: npx browserslist@latest --update-db
2022-04-21T02:11:56.182331+00:00 app[web.1]: 
2022-04-21T02:11:56.182332+00:00 app[web.1]: Why you should do it regularly:
2022-04-21T02:11:56.182333+00:00 app[web.1]: https://github.com/browserslist/browserslist#browsers-data-updating
2022-04-21T02:12:28.228963+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=bb-client-catstronauts.herokuapp.com request_id=e1deeb24-7121-4321-abba-6f11b032dcd0 fwd="68.175.91.109" dyno=web.1 connect=5000ms service=30000ms status=503 bytes=0 protocol=https
2022-04-21T02:12:52.886005+00:00 app[web.1]: Compiled successfully!
2022-04-21T02:12:52.886436+00:00 app[web.1]: 
2022-04-21T02:12:52.886496+00:00 app[web.1]: You can now view catstronauts-client-complete in the browser.
2022-04-21T02:12:52.886524+00:00 app[web.1]: 
2022-04-21T02:12:52.886558+00:00 app[web.1]: Local:            http://localhost:31159
2022-04-21T02:12:52.886591+00:00 app[web.1]: On Your Network:  http://172.16.40.166:31159
2022-04-21T02:12:52.886612+00:00 app[web.1]: 
2022-04-21T02:12:52.886629+00:00 app[web.1]: Note that the development build is not optimized.
2022-04-21T02:12:52.886775+00:00 app[web.1]: To create a production build, use npm run build.
2022-04-21T02:12:52.886829+00:00 app[web.1]: 
2022-04-21T02:12:52.898629+00:00 app[web.1]: /app/node_modules/watchpack/lib/chokidar.js:17
2022-04-21T02:12:52.898631+00:00 app[web.1]: throw new Error(
2022-04-21T02:12:52.898631+00:00 app[web.1]: ^
2022-04-21T02:12:52.898632+00:00 app[web.1]: 
2022-04-21T02:12:52.898632+00:00 app[web.1]: Error: No version of chokidar is available. Tried chokidar@2 and chokidar@3.
2022-04-21T02:12:52.898633+00:00 app[web.1]: You could try to manually install any chokidar version.
2022-04-21T02:12:52.898633+00:00 app[web.1]: chokidar@3: Error: Cannot find module 'chokidar'
2022-04-21T02:12:52.898634+00:00 app[web.1]: Require stack:
2022-04-21T02:12:52.898634+00:00 app[web.1]: - /app/node_modules/watchpack/lib/chokidar.js
2022-04-21T02:12:52.898635+00:00 app[web.1]: - /app/node_modules/watchpack/lib/DirectoryWatcher.js
2022-04-21T02:12:52.898635+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watcherManager.js
2022-04-21T02:12:52.898635+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watchpack.js
2022-04-21T02:12:52.898636+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeWatchFileSystem.js
2022-04-21T02:12:52.898636+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
2022-04-21T02:12:52.898636+00:00 app[web.1]: - /app/node_modules/webpack/lib/webpack.js
2022-04-21T02:12:52.898636+00:00 app[web.1]: - /app/node_modules/react-scripts/scripts/start.js
2022-04-21T02:12:52.898637+00:00 app[web.1]: chokidar@2: Error: Cannot find module 'watchpack-chokidar2'
2022-04-21T02:12:52.898637+00:00 app[web.1]: Require stack:
2022-04-21T02:12:52.898638+00:00 app[web.1]: - /app/node_modules/watchpack/lib/chokidar.js
2022-04-21T02:12:52.898638+00:00 app[web.1]: - /app/node_modules/watchpack/lib/DirectoryWatcher.js
2022-04-21T02:12:52.898638+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watcherManager.js
2022-04-21T02:12:52.898639+00:00 app[web.1]: - /app/node_modules/watchpack/lib/watchpack.js
2022-04-21T02:12:52.898639+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeWatchFileSystem.js
2022-04-21T02:12:52.898639+00:00 app[web.1]: - /app/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
2022-04-21T02:12:52.898639+00:00 app[web.1]: - /app/node_modules/webpack/lib/webpack.js
2022-04-21T02:12:52.898640+00:00 app[web.1]: - /app/node_modules/react-scripts/scripts/start.js
2022-04-21T02:12:52.898640+00:00 app[web.1]: 
2022-04-21T02:12:52.898640+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/watchpack/lib/chokidar.js:17:7)
2022-04-21T02:12:52.898640+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-21T02:12:52.898641+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-21T02:12:52.898641+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-21T02:12:52.898641+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-04-21T02:12:52.898642+00:00 app[web.1]: at Module.require (node:internal/modules/cjs/loader:1005:19)
2022-04-21T02:12:52.898642+00:00 app[web.1]: at require (node:internal/modules/cjs/helpers:102:18)
2022-04-21T02:12:52.898642+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/watchpack/lib/DirectoryWatcher.js:9:16)
2022-04-21T02:12:52.898643+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-21T02:12:52.898643+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-21T02:12:53.472392+00:00 heroku[web.1]: Process exited with status 1
2022-04-21T02:12:53.554913+00:00 heroku[web.1]: State changed from up to crashed
2022-04-21T02:15:14.491710+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bb-client-catstronauts.herokuapp.com request_id=9af15f60-14af-405d-aef4-fb3bf9b488c5 fwd="68.175.91.109" dyno= connect= service= status=503 bytes= protocol=https
2022-04-21T02:15:14.757612+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=bb-client-catstronauts.herokuapp.com request_id=0d3f9e4e-0c8e-40d1-be66-1f422cda77ee fwd="68.175.91.109" dyno= connect= service= status=503 bytes= protocol=https

So far Iā€™ve tried the following:

  • add chokidar and watchpack-chokidar2 as dependencies
  • add .npm to gitignore and removing it from tracking
  • add ā€œhomepageā€: ā€œ./ā€ to package.json
  • delete ā€œauthorā€ value from package.json (on a whim, mentioned as a possibility in a previous comment)

Any pointers appreciated. Really loved this course. Such a bummer to run into a blocker on the very last task.

Hi @lpisgood ! Thank you for the info - weā€™ll try to get this solved so you can get your certification! Almost there!

First, Heroku is currently having issues with its GitHub integration. Weā€™ve updated the course to include using the Heroku CLI instead to deploy your app. Have you used that approach? Youā€™ll see the instructions in this lesson, under the ā€œLearn more: Using the Heroku CLIā€ section.

Iā€™d also try deleting node_modules and doing a fresh npm install in the client folder before pushing it up to Heroku.

Let us know how that goes!

Hi @MichelleMabuyo, thanks for your response!

Yeah, I saw the messaging about Heroku and GitHub integration, so I followed the instructions for Heroku CLI. No issues with the server. And seemingly no issues with the client (eg: it builds and deploys with success message) until I tried to actually access the site.

I did manage to resolve the issue just now after digging a bit and finding this thread:

Instructions in case anyone is having the same problem:

Install serve:

npm install serve --s

and update the scripts in package.json as follows:

"scripts": {
    "dev": "react-scripts start",
    "start": "serve -s build",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "heroku-postbuild": "npm run build"
}

Seems unnecessary, but at least thereā€™s a workaround! :slight_smile:

Cheers,
Ben