You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error in onModuleInit doesn't bubble up to listenAsync function
(node:26531) UnhandledPromiseRejectionWarning: Error: error
at AppService.onModuleInit (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/dist/app.service.js:14:19)
at MapIterator.iteratee (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/@nestjs/core/hooks/on-module-init.hook.js:21:43)
at MapIterator.next (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/iterare/lib/map.js:13:39)
at IteratorWithOperators.next (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/iterare/lib/iterate.js:21:28)
at Function.from (<anonymous>)
at IteratorWithOperators.toArray (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/iterare/lib/iterate.js:180:22)
at callOperator (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/@nestjs/core/hooks/on-module-init.hook.js:22:10)
at Object.callModuleInitHook (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/@nestjs/core/hooks/on-module-init.hook.js:42:23)
at NestMicroservice.callInitHook (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/@nestjs/core/nest-application-context.js:152:27)
at NestMicroservice.registerModules (/Users/daniel/nest-microservice-onmoduleinit-not-exit-/node_modules/@nestjs/microservices/nest-microservice.js:45:24)
(node:26531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:26531) [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.
Bug Report
Current behavior
Error in
onModuleInit
doesn't bubble up tolistenAsync
functioncheck this repo for reproducing the issue
Expected behavior
Error should bubble up to listenAsync function and able to catch it
Possible Solution
https://github.com/nestjs/nest/blob/master/packages/microservices/nest-microservice.ts#L118
registerModules
returns a promise but not been handle correctly, should be fine if we handle it properlyEnvironment
The text was updated successfully, but these errors were encountered: