Open
Description
I'm submitting a...
[ ] Regression
[X ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When using nestjs as a NATS microservice, the nats payload (data), when using the @MessagePattern decorator, is always undefined.
@MessagePattern('sms.send')
test(data: any) {
console.log('function called OK');
console.log(data); // Allways undefined
}
In the provided example I can log "function called OK" but data is allways undefined.
Here is my main.ts
import { NestFactory } from '@nestjs/core';
import { Transport } from '@nestjs/microservices';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.NATS,
options: {
url: 'nats://nats:4222',
queue: 'sms',
},
});
app.listen(() => console.log('Microservice is listening'));
}
bootstrap();
I have tried both regular strings and json encoded objects as valid payloads.
Expected behavior
data should not be undefined
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Nest version: X.Y.Z
For Tooling issues:
- Node version: XX
- Platform:
Others: