diff --git a/lib/rmq.service.ts b/lib/rmq.service.ts index 4b48159..2e462a3 100644 --- a/lib/rmq.service.ts +++ b/lib/rmq.service.ts @@ -104,7 +104,7 @@ export class RMQService implements OnModuleInit { }, timeout); this.sendResponseEmitter.once(correlationId, (msg: Message) => { clearTimeout(timerId); - if (msg.properties.headers['-x-error']) { + if (msg.properties?.headers?.['-x-error']) { reject(this.errorService.errorHandler(msg)); } const { content } = msg;