Closed gfellerph closed 4 years ago
Can you try the solution in this PR #222 ? I may have to add a separate start script just for heroku.
Added a new script in the latest release, start-env
. See if that works for you.
@mikecao I don't understand how to use this solution. Heroku, after deploy, trying to start Umami using start command from package.json. Or it can use instructions from Procfile. How to use your custom command start-env
with Heroku?
It's npm run start-env
, but looks like you figured it out already in #248
I have the same problem getting the app to run on Heroku. I ran heroku run npm run start-env -a MYAPP
but ended up with this error
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fluffy-analytics.herokuapp.com request_id=SOME_STRING fwd="SOME_IP_ADDRESS" dyno= connect= service= status=503 bytes= protocol=https
@mikecao no, I currently have changes in a local commit, and deploy on Heroku with them:
"start": "next start -p $PORT"
I didn't find a way how to specify a custom start command for Heroku.
@KonstantinReido did you manage to get the app to run at all? every time i try to open the app, the logs say it crashed.
@huijing Yes. But to do it, I did a commit on my local master branch. In this commit, I changed package.json file:
1) "start": "next start -p $PORT"
2) moved package "dotenv": "^8.2.0"
to dependencies section
Hope it temporary changes :)
@huijing Can you try the latest release? v0.68.0
@huijing Can you try the latest release? v0.68.0
hello! i pulled from the latest master branch but the dotenv problem is still there
2020-10-02T00:28:38.054726+00:00 app[web.1]: Error: Cannot find module 'dotenv'
2020-10-02T00:28:38.054728+00:00 app[web.1]: Require stack:
2020-10-02T00:28:38.054729+00:00 app[web.1]: - /app/next.config.js
2020-10-02T00:28:38.054729+00:00 app[web.1]: - /app/node_modules/next/dist/next-server/server/config.js
2020-10-02T00:28:38.054730+00:00 app[web.1]: - /app/node_modules/next/dist/next-server/server/next-server.js
2020-10-02T00:28:38.054730+00:00 app[web.1]: - /app/node_modules/next/dist/server/next.js
2020-10-02T00:28:38.054730+00:00 app[web.1]: - /app/node_modules/next/dist/server/lib/start-server.js
2020-10-02T00:28:38.054731+00:00 app[web.1]: - /app/node_modules/next/dist/cli/next-start.js
2020-10-02T00:28:38.054731+00:00 app[web.1]: - /app/node_modules/next/dist/bin/next
2020-10-02T00:28:38.054732+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
2020-10-02T00:28:38.054732+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:841:27)
2020-10-02T00:28:38.054733+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-10-02T00:28:38.054733+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-10-02T00:28:38.054733+00:00 app[web.1]: at Object.<anonymous> (/app/next.config.js:1:1)
2020-10-02T00:28:38.054734+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-10-02T00:28:38.054734+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-10-02T00:28:38.054735+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-10-02T00:28:38.054735+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14)
2020-10-02T00:28:38.054735+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19) {
2020-10-02T00:28:38.054736+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-10-02T00:28:38.054736+00:00 app[web.1]: requireStack: [
2020-10-02T00:28:38.054737+00:00 app[web.1]: '/app/next.config.js',
2020-10-02T00:28:38.054737+00:00 app[web.1]: '/app/node_modules/next/dist/next-server/server/config.js',
2020-10-02T00:28:38.054740+00:00 app[web.1]: '/app/node_modules/next/dist/next-server/server/next-server.js',
2020-10-02T00:28:38.054740+00:00 app[web.1]: '/app/node_modules/next/dist/server/next.js',
2020-10-02T00:28:38.054740+00:00 app[web.1]: '/app/node_modules/next/dist/server/lib/start-server.js',
2020-10-02T00:28:38.054741+00:00 app[web.1]: '/app/node_modules/next/dist/cli/next-start.js',
2020-10-02T00:28:38.054741+00:00 app[web.1]: '/app/node_modules/next/dist/bin/next'
2020-10-02T00:28:38.054741+00:00 app[web.1]: ]
2020-10-02T00:28:38.054742+00:00 app[web.1]: }
2020-10-02T00:28:38.065268+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-10-02T00:28:38.065516+00:00 app[web.1]: npm ERR! errno 1
2020-10-02T00:28:38.068161+00:00 app[web.1]: npm ERR! umami@0.68.0 start: `next start`
2020-10-02T00:28:38.068274+00:00 app[web.1]: npm ERR! Exit status 1
2020-10-02T00:28:38.068443+00:00 app[web.1]: npm ERR!
2020-10-02T00:28:38.068575+00:00 app[web.1]: npm ERR! Failed at the umami@0.68.0 start script.
2020-10-02T00:28:38.068699+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-02T00:28:38.078908+00:00 app[web.1]:
2020-10-02T00:28:38.079077+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-10-02T00:28:38.079158+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-10-02T00_28_38_070Z-debug.log
2020-10-02T00:28:38.143447+00:00 heroku[web.1]: Process exited with status 1
2020-10-02T00:28:38.178337+00:00 heroku[web.1]: State changed from starting to crashed
The 2 changes to the package.json
file as @KonstantinReido suggested did work though and I am able to run the application now. Definitely a Heroku problem.
Sounds like Heroku is pruning dotenv even thought Next needs it too. Ok I can move the dotenv package over.
I tried the heroku setup, but the app fails to bind to $PORT (it starts on :3000). Is there an additional setting required?
2020-09-29T11:01:43.419604+00:00 heroku[web.1]: State changed from crashed to starting 2020-09-29T11:01:54.869156+00:00 heroku[web.1]: Starting process with command
npm start
2020-09-29T11:01:56.938453+00:00 app[web.1]: 2020-09-29T11:01:56.938470+00:00 app[web.1]: > umami@0.58.0 start /app 2020-09-29T11:01:56.938470+00:00 app[web.1]: > next start 2020-09-29T11:01:56.938471+00:00 app[web.1]: 2020-09-29T11:01:57.168720+00:00 app[web.1]: ready - started server on http://localhost:3000 2020-09-29T11:02:55.215714+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2020-09-29T11:02:55.237872+00:00 heroku[web.1]: Stopping process with SIGKILL 2020-09-29T11:02:55.303892+00:00 heroku[web.1]: Process exited with status 137 2020-09-29T11:02:55.333479+00:00 heroku[web.1]: State changed from starting to crashed