Heroku. The server responded with a status of 503 (Service Unavailable)

  angular, heroku, node.js

When I build my project from GitHub – It shows no error, except this one

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true

I’ve updated package.json with such libraries as "bcrypt", "passport" and "passport-local".
Here is my package.json:

{
  "name": "web-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "node server/index.js",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "heroku-postbuild": "ng build --prod",
    "postinstall": "ng build"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~11.1.2",
    "@angular/cdk": "^11.2.2",
    "@angular/cli": "^11.2.2",
    "@angular/common": "~11.1.2",
    "@angular/compiler": "^11.1.2",
    "@angular/compiler-cli": "^11.2.3",
    "@angular/core": "~11.1.2",
    "@angular/forms": "~11.1.2",
    "@angular/material": "^11.2.2",
    "@angular/platform-browser": "~11.1.2",
    "@angular/platform-browser-dynamic": "~11.1.2",
    "@angular/router": "~11.1.2",
    "angular-file": "^3.4.0",
    "body-parser": "^1.19.0",
    "bootstrap": "^4.6.0",
    "bootstrap-icons": "^1.3.0",
    "compression": "^1.7.4",
    "express": "^4.17.1",
    "jquery": "^3.5.1",
    "mysql": "^2.18.1",
    "nodemon": "^2.0.7",
    "passport": "^0.4.1",
    "passport-local": "^1.0.0",
    "path": "^0.12.7",
    "popper.js": "^1.16.1",
    "rxjs": "~6.6.0",
    "server.js": "^1.0.0",
    "tslib": "^2.0.0",
    "typescript": "~4.1.2",
    "zone.js": "~0.11.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1101.4",
    "@angular/cli": "^11.2.2",
    "@angular/compiler-cli": "^11.2.3",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "bcrypt": "^5.0.1",
    "codelyzer": "^6.0.0",
    "ejs": "^3.1.6",
    "enhanced-resolve": "^3.3.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.2.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0"
  },
  "engines": {
    "node": "10.19.0",
    "npm": "6.14.11"
  }
}

Last ~30 commits I’ve never got this error before, but as for now my app is not working.

Here is my full build log except angular compilation part:

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  10.19.0
       engines.npm (package.json):   6.14.11
       
       Resolving node version 10.19.0...
       Downloading and installing node 10.19.0...
       Bootstrapping npm 6.14.11 (replacing 6.13.4)...
       npm 6.14.11 installed
       
-----> Restoring cache
       - node_modules
       
-----> Installing dependencies
       Installing node modules
       
       > [email protected] install /tmp/build_1f067458/node_modules/webpack-dev-server/node_modules/fsevents
       > node install.js
       
       
       Skipping 'fsevents' build as platform linux is not supported
       
       > [email protected] install /tmp/build_1f067458/node_modules/watchpack-chokidar2/node_modules/fsevents
       > node install.js
       
       
       Skipping 'fsevents' build as platform linux is not supported
       
       > [email protected] postinstall /tmp/build_1f067458/node_modules/core-js
       > node -e "try{require('./postinstall')}catch(e){}"
       
       
       > [email protected] postinstall /tmp/build_1f067458/node_modules/nodemon
       > node bin/postinstall || exit 0
       
       Love nodemon? You can now support the project via the open collective:
        > https://opencollective.com/nodemon/donate
       
       
       > [email protected] install /tmp/build_1f067458/node_modules/bcrypt
       > node-pre-gyp install --fallback-to-build
       
       [bcrypt] Success: "/tmp/build_1f067458/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" is installed via remote
       
       > @angular/[email protected] postinstall /tmp/build_1f067458/node_modules/@angular/cli
       > node ./bin/postinstall/script.js
       
       
       > [email protected] postinstall /tmp/build_1f067458
       > ng build
       
       
       Compiling @angular/material/tree : es2015 as esm2015
       - Generating browser application bundles...
       ✔ Browser application bundle generation complete.
       - Copying assets...
       ✔ Copying assets complete.
       - Generating index html...
       ✔ Index html generation complete.
       
       Initial Chunk Files | Names         |      Size
       vendor.js           | vendor        |   6.18 MB
       main.js             | main          |   2.81 MB
       polyfills.js        | polyfills     | 128.74 kB
       styles.css          | styles        |  73.95 kB
       runtime.js          | runtime       |   6.15 kB
       
       | Initial Total |   9.19 MB
       
       Build at: 2021-04-18T01:22:33.482Z - Hash: 70727fc56f49d2684bfc - Time: 135759ms
       added 1954 packages in 189.692s
       
-----> Build
       Detected both "build" and "heroku-postbuild" scripts
       Running heroku-postbuild
       
       > [email protected] heroku-postbuild /tmp/build_1f067458
       > ng build --prod
       
- Generating browser application bundles...
✔ Browser application bundle generation complete.
- Copying assets...
✔ Copying assets complete.
- Generating index html...
✔ Index html generation complete.
       
       Initial Chunk Files               | Names         |     Size
       main.d44826d1540f51b7b998.js      | main          |  1.30 MB
       styles.a0c3c2cca1c823455873.css   | styles        | 71.74 kB
       polyfills.00096ed7d93ed26ee6df.js | polyfills     | 35.98 kB
       runtime.7b63b9fd40098a2e8207.js   | runtime       |  1.45 kB
       
       | Initial Total |  1.41 MB
       
Warning: budgets: initial exceeded maximum budget. Budget 500.00 kB was not met by 942.10 kB with a total of 1.41 MB.
       Build at: 2021-04-18T01:24:10.097Z - Hash: 1729059a737323a4a451 - Time: 83796ms
       
-----> Caching build
       - node_modules
       
-----> Pruning devDependencies
       removed 1453 packages and audited 500 packages in 18.983s
       
       34 packages are looking for funding
         run `npm fund` for details
       
       found 0 vulnerabilities
       
       
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 84.1M
-----> Launching...
       Released v46
       myHerokuWebsite deployed to Heroku

this is what I get when I open console:

Failed to load resource: the server responded with a status of 503 (Service Unavailable)

Where should I look for a mistake?

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.