AlariCode / nestjs-rmq

A custom library for NestJS microservice. It allows you to use RabbitMQ or AMQP.
https://purpleschool.ru
MIT License
285 stars 38 forks source link

Cannot read property 'MICROSERVICE_READY' of undefined #3

Closed juristr closed 5 years ago

juristr commented 5 years ago

Hi,

just tried ur lib (as we discussed over at the NestJS issue tracker). However, when I add nestjs-rmq (latest version from npm 0.1.2).

However when running it as described in the README, I get the following error:

TypeError: Cannot read property 'MICROSERVICE_READY' of undefined
    at NestMicroservice.listen (/Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/node_modules/@nestjs/microservices/nest-microservice.js:79:46)
    at exceptions_zone_1.ExceptionsZone.run (/Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/node_modules/@nestjs/core/nest-factory.js:99:48)
    at Function.run (/Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/node_modules/@nestjs/core/errors/exceptions-zone.js:8:13)
    at Proxy.args (/Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/node_modules/@nestjs/core/nest-factory.js:98:54)
    at /Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/src/main.ts:15:7
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/src/main.ts:4:58)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
    at Function.Module.runMain (module.js:684:11)
    at Object.<anonymous> (/Users/jstrumpflohner/sites/r3-gateway/node/proxy-coordinator/node_modules/ts-node/src/bin.ts:157:12)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
(node:4009) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Unhandled Runtime Exception.
(node:4009) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any idea?

My package.json deps

{
  "dependencies": {
    "@nestjs/common": "^5.1.0",
    "@nestjs/core": "^5.1.0",
    "nestjs-rmq": "^0.1.2",
    "reflect-metadata": "^0.1.12",
    "rxjs": "^6.2.2",
    "typescript": "^3.0.1"
  },
  "devDependencies": {
    "@nestjs/testing": "^5.1.0",
    "@types/express": "^4.16.0",
    "@types/jest": "^23.3.1",
    "@types/node": "^10.7.1",
    "@types/supertest": "^2.0.5",
    "jest": "^23.5.0",
    "nodemon": "^1.18.3",
    "prettier": "^1.14.2",
    "rimraf": "^2.6.2",
    "supertest": "^3.1.0",
    "ts-jest": "^23.1.3",
    "ts-loader": "^4.4.2",
    "ts-node": "^7.0.1",
    "tsconfig-paths": "^3.5.0",
    "tslint": "5.11.0",
    "webpack": "^4.16.5",
    "webpack-cli": "^3.1.0",
    "webpack-node-externals": "^1.7.2"
  }
}

thx

AlariCode commented 5 years ago

@juristr thanks for using package! At first glance the problem that you need @nestjs/microservice package in your dependencies. Or just generate fresh project with nest new my-project using nest cli (tested it right now, everything seams fine).

juristr commented 5 years ago

@AlariCode Great, that was it. Strange, generated the project today morning. Maybe @nestjs/microservices should be a peerDependency of this package?

I'll try to play around with ur lib today afternoon again (be warned, more questions may come along 😅)

Thanks for now!

AlariCode commented 5 years ago

@juristr no problem) You are right. I'll add @nestjs/microservices to peerDependency.

AlariCode commented 5 years ago

@juristr added peerDependency in 0.1.3