toundji
toundji

Reputation: 21

Nestjs with Heroku : Error R15 (Memory quota vastly exceeded)

I successfully deploy a backend application using Nestjs technology on heroku. Then I added the twilio service to the project to send sms and the deployment no longer works. In the console I get the error:

Process running mem=973M(190.2%) Error R14 (Memory quota exceeded) Stopping all processes with SIGTERM Process exited with status 143

I tried several solutions without success including the command: heroku config:set NODE_OPTIONS="--max_old_space_size=2560"

Here is the content of my package.json

{
  ......

  "scripts": {
    "prebuild": "rimraf dist",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "build": "nest build",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json",
    "typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js --config src/utils/ormconfig.ts",
    "migration:generate": "npm run build && npm run typeorm migration:generate -- -n db",
    "migration:run": "npm run build && npm run typeorm migration:run"
    },
  "dependencies": {
    "@nestjs/cli": "^9.1.4",
    "@nestjs/common": "^9.1.4",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.1.4",
    "@nestjs/jwt": "^9.0.0",
    "@nestjs/mapped-types": "*",
    "@nestjs/passport": "^9.0.0",
    "@nestjs/platform-express": "^9.1.4",
    "@nestjs/platform-socket.io": "^9.1.4",
    "@nestjs/swagger": "^6.1.2",
    "@nestjs/typeorm": "^9.0.1",
    "@nestjs/websockets": "^9.1.4",
    "@types/socket.io": "^3.0.2",
    "aws-node-sns": "^0.0.3",
    "aws-sdk": "^2.1241.0",
    "bcrypt": "^5.1.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "firebase-admin": "^11.1.0",
    "kkiapay-nodejs-sdk": "github:kkiapay/nodejs-sdk",
    "passport": "^0.6.0",
    "passport-headerapikey": "^1.2.2",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "pg": "^8.8.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.5.7",
    "swagger-ui-express": "^4.5.0",
    "typeorm": "^0.3.10"
  },
  "devDependencies": {
    "@nestjs/schematics": "^9.0.3",
    "@nestjs/testing": "^9.1.4",
    "@types/bcrypt": "^5.0.0",
    "@types/dotenv": "^8.2.0",
    "@types/express": "^4.17.14",
    "@types/jest": "29.1.2",
    "@types/node": "^18.11.0",
    "@types/passport-jwt": "^3.0.7",
    "@types/passport-local": "^1.0.34",
    "jest": "29.2.0",
    "prettier": "^2.7.1",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.0",
    "ts-jest": "29.0.3",
    "ts-loader": "^9.4.1",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "4.1.0",
    "typescript": "^4.8.4"
  },

  .....

  "engines": {
    "node": "16.14.0",
    "npm": "8.5.2"
  }
}

Upvotes: 2

Views: 780

Answers (1)

Johannes
Johannes

Reputation: 89

The Heroku dynos (free, hobby and standard 1x) have a maximum memory of 512 MB (https://devcenter.heroku.com/articles/limits#dynos). It seems that the Twilio service requires more resources.

Upvotes: 1

Related Questions