mars / heroku-nextjs

⏩ Deploy Next.js universal web apps to Heroku
https://nextjs.herokuapp.com
MIT License
371 stars 36 forks source link

Timeout (free quota exhausted) #53

Closed sliktrik closed 4 years ago

sliktrik commented 4 years ago

Hello

I've just attempted to deploy a new copy of https://github.com/mars/heroku-nextjs to heroku and got the following error

2019-12-30T06:37:09.356034+00:00 heroku[web.1]: Starting process with command `bin/boot`
2019-12-30T06:37:11.971453+00:00 app[web.1]: ls: cannot access '/app/build/static/js/*.js': No such file or directory
2019-12-30T06:37:11.972088+00:00 app[web.1]: Error injecting runtime env: bundle not found '/app/build/static/js/*.js'. See: https://github.com/mars/create-react-app-buildpack/blob/master/README.md#user-content-custom-bundle-location
2019-12-30T06:37:12.483926+00:00 app[web.1]: Starting log redirection...
2019-12-30T06:37:12.484412+00:00 app[web.1]: Starting nginx...
2019-12-30T06:37:13.678901+00:00 heroku[web.1]: State changed from starting to up
2019-12-30T06:37:13.699300+00:00 heroku[web.1]: Idling
2019-12-30T06:37:13.703153+00:00 heroku[web.1]: State changed from up to down
2019-12-30T06:37:13.715516+00:00 heroku[web.1]: Idling because quota is exhausted
2019-12-30T06:37:14.571041+00:00 heroku[router]: at=info code=H82 desc="Free app running time quota exhausted" method=GET path="/" host=draft-stikeez.herokuapp.com request_id=e34d37a0-4d93-42ee-96f7-92de4e163a94 fwd="124.168.156.8" dyno= connect= service= status=503 bytes= protocol=https
2019-12-30T06:37:14.879169+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-12-30T06:37:14.904675+00:00 app[web.1]: Going down, terminating child processes...
2019-12-30T06:37:14.990085+00:00 heroku[web.1]: Process exited with status 0
2019-12-30T06:37:15.315655+00:00 heroku[router]: at=info code=H82 desc="Free app running time quota exhausted" method=GET path="/favicon.ico" host=draft-stikeez.herokuapp.com request_id=a5ef925f-4357-460a-bbc7-b1442cc4b22c fwd="124.168.156.8" dyno= connect= service= status=503 bytes= protocol=https

ive then set the config heroku config:set JS_RUNTIME_TARGET_BUNDLE=/app/.next/static/chunks/*.js

and still get the following...

2019-12-30T06:49:10.892511+00:00 heroku[web.1]: Starting process with command `bin/boot`
2019-12-30T06:49:12.556419+00:00 app[web.1]: Injecting runtime env into /app/.next/static/chunks/commons.ee207d0e464a70a92a54.js (from .profile.d/inject_react_app_env.sh)
2019-12-30T06:49:12.830838+00:00 app[web.1]: Starting log redirection...
2019-12-30T06:49:12.830893+00:00 app[web.1]: Starting nginx...
2019-12-30T06:49:13.297037+00:00 heroku[web.1]: State changed from starting to up
2019-12-30T06:49:13.317931+00:00 heroku[web.1]: Idling
2019-12-30T06:49:13.322156+00:00 heroku[web.1]: State changed from up to down
2019-12-30T06:49:13.335155+00:00 heroku[web.1]: Idling because quota is exhausted
2019-12-30T06:49:14.065257+00:00 app[web.1]: Going down, terminating child processes...
2019-12-30T06:49:14.056227+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-12-30T06:49:14.118500+00:00 heroku[web.1]: Process exited with status 0

any ideas as to what im doing wrong?

Thanks in advance

sliktrik commented 4 years ago

package.json

{
  "name": "heroku-nextjs",
  "version": "1.0.0",
  "description": "Deploy Next.js server-side React apps to Heroku",
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start -p $PORT"
  },
  "engines": {
    "node": "10"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/mars/heroku-nextjs.git"
  },
  "keywords": [
    "react",
    "ssr",
    "server-side-rendering"
  ],
  "author": "Mars Hall",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/mars/heroku-nextjs/issues"
  },
  "homepage": "https://github.com/mars/heroku-nextjs#readme",
  "dependencies": {
    "next": "^9.0.6",
    "react": "^16.9.0",
    "react-dom": "^16.9.0"
  }
}
mars commented 4 years ago

The free dyno is idling until a request comes in. If you want to avoiding the app temporarily shutting down like that, upgrade to a Hobby dyno or better.