Search code examples
node.jsnestjsmikro-orm

TypeError: domain.enter is not a function


Describe the bug I am trying to migrate to Mikro-Orm and I have been stuck with this error for > 3 days, where the problem with the error is that it's not helping me knowing where it's coming from, and the problem is that it happens on random areas, I commented a lot of code and trying to isolate where it's coming from but it's unpredictable. I've did a lot of research and I came up with this https://github.com/mysqljs/mysql/issues/1949 and https://github.com/sipcentric/node-pbx-client/issues/4 , the only i can think about it's the mysql which is why i'm guessing it might be liked to MikroOrm.

Any expert advise would be a lot appreciated please.

The problem is that nestjs api that I'm bolding is not responding with the response

Stack trace

domain.js:547
  domain.enter();
         ^

TypeError: domain.enter is not a function
    at IncomingMessage.EventEmitter.emit (domain.js:547:10)
    at resume_ (_stream_readable.js:972:10)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

To Reproduce I don't know how it's occurring.

Versions Below are all the dependencies of the project:

 "dependencies": {
    "@angular/animations": "~10.1.4",
    "@angular/cdk": "^10.2.3",
    "@angular/common": "~10.1.4",
    "@angular/compiler": "~10.1.4",
    "@angular/core": "~10.1.4",
    "@angular/forms": "~10.1.4",
    "@angular/localize": "^10.0.4",
    "@angular/material": "^10.2.3",
    "@angular/platform-browser": "~10.1.4",
    "@angular/platform-browser-dynamic": "~10.1.4",
    "@angular/router": "~10.1.4",
    "@fortawesome/angular-fontawesome": "^0.7.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.30",
    "@fortawesome/free-brands-svg-icons": "^5.14.0",
    "@fortawesome/free-regular-svg-icons": "^5.14.0",
    "@fortawesome/free-solid-svg-icons": "^5.14.0",
    "@mikro-orm/core": "^4.3.4",
    "@mikro-orm/mariadb": "^4.3.4",
    "@mikro-orm/mysql": "^4.3.4",
    "@mikro-orm/nestjs": "^4.2.0",
    "@mikro-orm/reflection": "^4.3.4",
    "@mikro-orm/sql-highlighter": "^1.0.1",
    "@nestjs/common": "^7.5.1",
    "@nestjs/core": "^7.5.1",
    "@nestjs/passport": "^7.1.0",
    "@nestjs/platform-express": "^7.5.1",
    "@nestjs/schedule": "^0.4.1",
    "@nestjs/swagger": "^4.6.1",
    "@ng-bootstrap/ng-bootstrap": "^7.0.0",
    "@tinymce/tinymce-angular": "^4.1.0",
    "angular-calendar": "^0.28.16",
    "angular-google-charts": "^1.1.4",
    "basic-auth": "^2.0.1",
    "bootstrap": "^4.5.0",
    "class-transformer": "^0.3.1",
    "class-validator": "^0.12.2",
    "clipboard": "^2.0.6",
    "cookie-parser": "^1.4.5",
    "core-js": "^3.6.5",
    "credit-card-type": "^9.1.0",
    "cryptojs": "^2.5.3",
    "date-fns": "^2.15.0",
    "express": "^4.17.1",
    "express-list-routes": "^0.1.4",
    "express-mysql-session": "^2.1.4",
    "express-session": "^1.17.1",
    "font-awesome": "^4.7.0",
    "helmet": "^4.1.1",
    "imap": "^0.8.19",
    "jquery": "^3.5.1",
    "locutus": "^2.0.14",
    "mermaid": "^8.6.0",
    "mikro-orm": "^4.3.4",
    "monaco-editor": "^0.20.0",
    "mysql": "^2.18.1",
    "nest-winston": "^1.4.0",
    "nestjs-mikro-orm": "^1.0.3",
    "nestjs-session": "^1.0.1",
    "ng-pick-datetime": "^7.0.0",
    "ngx-avatar": "^4.0.0",
    "ngx-bootstrap": "^5.6.1",
    "ngx-clipboard": "^13.0.1",
    "ngx-cookie-service": "^3.0.4",
    "ngx-monaco-editor": "^9.0.0",
    "node-cryptojs-aes": "^0.4.0",
    "passport": "^0.4.1",
    "passport-local": "^1.0.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "~6.6.0",
    "swagger-ui-express": "^4.1.4",
    "tslib": "^2.0.0",
    "winston": "^3.3.3",
    "xlsx": "^0.16.8",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1001.4",
    "@angular/cli": "~10.1.4",
    "@angular/compiler-cli": "~10.1.4",
    "@angular/language-service": "^10.0.4",
    "@compodoc/compodoc": "^1.1.11",
    "@nestjs/cli": "^7.5.1",
    "@nestjs/schematics": "^7.1.3",
    "@nestjs/testing": "^7.5.1",
    "@types/clipboard": "^2.0.1",
    "@types/cryptojs": "^3.1.29",
    "@types/express": "^4.17.3",
    "@types/express-session": "^1.17.3",
    "@types/imap": "^0.8.31",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/jest": "26.0.10",
    "@types/jquery": "^3.5.4",
    "@types/jqueryui": "^1.12.13",
    "@types/node": "12.12.41",
    "@types/passport-local": "^1.0.33",
    "@types/supertest": "^2.0.8",
    "@types/webpack-env": "^1.15.3",
    "@typescript-eslint/eslint-plugin": "3.9.1",
    "@typescript-eslint/parser": "3.9.1",
    "codelyzer": "^6.0.0",
    "eslint": "7.7.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.20.1",
    "eslint-plugin-prettier": "^3.1.3",
    "husky": "^4.2.5",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "jest": "26.4.2",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "npm-run-all": "^4.1.5",
    "prettier": "^1.19.1",
    "pretty-quick": "^2.0.1",
    "protractor": "~7.0.0",
    "supertest": "^4.0.2",
    "ts-jest": "26.2.0",
    "ts-loader": "^6.2.1",
    "ts-node": "9.0.0",
    "tsconfig-paths": "^3.9.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2",
    "wait-on": "^5.2.0",
    "webpack-env": "^0.8.0"
  },

My node version is v14.15.1


Solution

  • I found out what was the problem, it turns out that I was overriding request.domain during one of my middlewares.