Closed i-kitaev closed 5 years ago
@Vnkitaev, thanks for report, I'll check with latest version of NestJS.
@Vnkitaev, tested with:
"dependencies": {
"@nestjs/common": "^5.3.6",
"@nestjs/core": "^5.3.6",
"@nestjs/microservices": "^5.3.6",
"@nestjs/testing": "^5.0.0",
"@nestjs/websockets": "^5.0.0",
"nestjs-rmq": "0.1.1"
},
No error. Everything seams fine.
Could you provide actual code, that causes this error?
await NestFactory.createMicroservice(ApplicationModule, {
strategy: new ServerRMQ({
urls: ['amqp://guest:guest@localhost:5672'],
queue: 'test',
queueOptions: { durable: false }
})
});
await this.app.listen(3000);
ApplicationModule is empty.
If the callback is optional, maybe add check is callback a function? https://github.com/AlariCode/nestjs-rmq/blob/8b576be1d441f087b6ba1f19390e43bfe35c9cfe/lib/server/server.ts#L41
@Vnkitaev, I updated package to 0.1.2
and added additional check if callback is a function. Now your error must be gone. But NestJS insists, that callback must be a function. Even if I set it to number, listen()
still warn about error:
When you start microservice you don't specify any port: https://docs.nestjs.com/microservices/basics
import { NestFactory } from '@nestjs/core';
import { Transport } from '@nestjs/microservices';
import { ApplicationModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.createMicroservice(ApplicationModule, {
transport: Transport.TCP,
});
app.listen(() => console.log('Microservice is listening'));
}
bootstrap();
But additional check will be ok) Thanks for submitting an issue 👍
Thanks your :)
Hello, i have this exception.
Unhandled rejection TypeError: callback is not a function on https://github.com/AlariCode/nestjs-rmq/blob/8b576be1d441f087b6ba1f19390e43bfe35c9cfe/lib/server/server.ts#L50
I used packages: "@nestjs/core": "5.3.6", "@nestjs/common": "5.3.6", "nestjs-rmq": "0.1.1"