简体   繁体   中英

Angular NodeJs App Running Fine Locally But Throwing Error On Heroku Deployment

I have an application deployed on heroku. When I run the application locally, it runs fine but in dev deployment branch I get the error below. I did some research on similar errors reported but nothing helped. The error is so vague that I have had no progress after doing alot of research and spending so much time on it. Any help would be appreciated. let me know if you need code and i will post it.

The error on heroku is:

   2022-06-24T05:06:54.830575+00:00 heroku[web.1]: Starting process with command `node server.js`
    2022-06-24T05:06:56.651549+00:00 app[web.1]: internal/util.js:257
    2022-06-24T05:06:56.651563+00:00 app[web.1]: throw new ERR_INVALID_ARG_TYPE('original', 'Function', original);
    2022-06-24T05:06:56.651564+00:00 app[web.1]: ^
    2022-06-24T05:06:56.651564+00:00 app[web.1]: 
    2022-06-24T05:06:56.651564+00:00 app[web.1]: TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type Function. Received type undefined
    2022-06-24T05:06:56.651565+00:00 app[web.1]: at promisify (internal/util.js:257:11)
    2022-06-24T05:06:56.651565+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/compress-brotli/src/index.js:9:18)
    2022-06-24T05:06:56.651566+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:688:30)
    2022-06-24T05:06:56.651566+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    2022-06-24T05:06:56.651566+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:598:32)
    2022-06-24T05:06:56.651567+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    2022-06-24T05:06:56.651567+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    2022-06-24T05:06:56.651567+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:636:17)
    2022-06-24T05:06:56.651568+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
    2022-06-24T05:06:56.651568+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/keyv/src/index.js:5:24)
    2022-06-24T05:06:56.651568+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:688:30)
    2022-06-24T05:06:56.651569+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    2022-06-24T05:06:56.651569+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:598:32)
    2022-06-24T05:06:56.651569+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    2022-06-24T05:06:56.651570+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    2022-06-24T05:06:56.651570+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:636:17)
    2022-06-24T05:06:56.803235+00:00 heroku[web.1]: Process exited with status 1
    2022-06-24T05:06:56.906756+00:00 heroku[web.1]: State changed from starting to crashed
    2022-06-24T05:06:56.912609+00:00 heroku[web.1]: State changed from crashed to starting
    2022-06-24T05:07:14.587450+00:00 heroku[web.1]: Starting process with command `node server.js`
    2022-06-24T05:07:16.213560+00:00 heroku[web.1]: Process exited with status 1
    2022-06-24T05:07:16.261857+00:00 heroku[web.1]: State changed from starting to crashed
    2022-06-24T05:07:16.092142+00:00 app[web.1]: internal/util.js:257
    2022-06-24T05:07:16.092153+00:00 app[web.1]: throw new ERR_INVALID_ARG_TYPE('original', 'Function', original);
    2022-06-24T05:07:16.092154+00:00 app[web.1]: ^
    2022-06-24T05:07:16.092154+00:00 app[web.1]: 
    2022-06-24T05:07:16.092164+00:00 app[web.1]: TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type Function. Received type undefined
    2022-06-24T05:07:16.092164+00:00 app[web.1]: at promisify (internal/util.js:257:11)
    2022-06-24T05:07:16.092165+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/compress-brotli/src/index.js:9:18)
    2022-06-24T05:07:16.092165+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:688:30)
    2022-06-24T05:07:16.092165+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    2022-06-24T05:07:16.092165+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:598:32)
    2022-06-24T05:07:16.092166+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    2022-06-24T05:07:16.092166+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    2022-06-24T05:07:16.092166+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:636:17)
    2022-06-24T05:07:16.092166+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
    2022-06-24T05:07:16.092167+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/keyv/src/index.js:5:24)
    2022-06-24T05:07:16.092167+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:688:30)
    2022-06-24T05:07:16.092167+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    2022-06-24T05:07:16.092167+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:598:32)
    2022-06-24T05:07:16.092168+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    2022-06-24T05:07:16.092168+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    2022-06-24T05:07:16.092168+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:636:17)

package.json:

{
  "name": "app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "main": "server.js",
    "heroku-postbuild": "ng build --aot --configuration=${ENV}",
    "preinstall": "npm install -g @angular/cli @angular/compiler-cli typescript",
    "start": "ng serve",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "^0.1100.5",
    "@angular/animations": "^11.0.5",
    "@angular/cdk": "^11.0.3",
    "@angular/cli": "11.0.5",
    "@angular/common": "^11.0.5",
    "@angular/compiler": "~11.2.14",
    "@angular/compiler-cli": "~11.2.14",
    "@angular/core": "^11.0.5",
    "@angular/flex-layout": "^11.0.0-beta.33",
    "@angular/forms": "^11.0.5",
    "@angular/language-service": "^11.0.5",
    "@angular/localize": "^11.0.5",
    "@angular/material": "^11.0.3",
    "@angular/platform-browser": "11.0.5",
    "@angular/platform-browser-dynamic": "11.0.5",
    "@angular/router": "11.0.5",
    "@ng-bootstrap/ng-bootstrap": "^5.3.1",
    "@ng-bootstrap/schematics": "^2.0.0-alpha.1",
    "@ngtools/webpack": "^11.0.5",
    "@ngx-translate/core": "13.0.0",
    "@ngx-translate/http-loader": "^4.0.0",
    "@types/chart.js": "^2.7.42",
    "@types/chartist": "^0.11.0",
    "@types/express": "^4.17.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/lodash": "^4.14.135",
    "@types/node": "^8.10.66",
    "@types/uuid": "^8.3.0",
    "@types/w3c-web-usb": "^1.0.4",
    "@types/web-bluetooth": "0.0.4",
    "angular-bootstrap-md": "^7.4.3",
    "angular-cc-library": "^2.1.2",
    "angular-cli-ghpages": "^0.6.2",
    "angular-notifier": "^4.1.1",
    "angular-responsive-carousel": "^2.0.2",
    "angular5-csv": "^0.2.11",
    "apexcharts": "^3.25.0",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.3",
    "bootstrap": "^4.5.3",
    "chart.js": "^2.9.4",
    "chartist": "^0.11.4",
    "config": "^3.3.6",
    "core-js": "^2.5.4",
    "cors": "^2.8.5",
    "css-loader": "^2.1.0",
    "dotenv": "^6.1.0",
    "exec": "^0.2.1",
    "express": "^4.16.4",
    "express-jwt": "^5.3.1",
    "font-awesome": "^4.7.0",
    "fontawesome": "^5.6.3",
    "got": "^11.8.1",
    "hammerjs": "^2.0.8",
    "jsonwebtoken": "^8.2.2",
    "lodash": "^4.17.11",
    "material-design-lite": "^1.3.0",
    "mdbootstrap": "^4.19.2",
    "mongodb": "^3.0.10",
    "mongoose": "^5.1.4",
    "ng-apexcharts": "1.5.12",
    "ng-chartist": "^4.1.0",
    "ng-multiselect-dropdown": "^0.2.3",
    "ngx-autosize": "^1.8.4",
    "ngx-bootstrap": "^6.2.0",
    "ngx-chess-board": "2.0.7",
    "ngx-guided-tour": "^1.1.11",
    "path": "^0.12.7",
    "popper.js": "^1.15.0",
    "protractor": "^7.0.0",
    "remote-pay-cloud": "3.1.0",
    "remote-pay-cloud-api": "^4.0.3",
    "request": "^2.88.2",
    "request-promise": "^4.2.4",
    "resize-base64": "^1.0.12",
    "rootpath": "^0.1.2",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.3.3",
    "time-ago-pipe": "^1.3.2",
    "ts-node": "6.0.0",
    "typescript": "4.0.5",
    "uuid": "^3.3.2",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/core": "^11.0.5",
    "@angular-devkit/schematics": "^11.0.5",
    "codelyzer": "^5.0.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "ng2-charts-schematics": "^0.1.7",
    "protractor": "^7.0.0",
    "tslint": "~6.1.3"
  },
  "engines": {
    "node": "10.13",
    "npm": "6.9.0"
  }
}

The issue seemed to be in the dependencies. For anyone running into this issue, run ng update and npm audit fix --force . That will update dependencies which fixed the issue for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM