golevelup / nestjs

A collection of badass modules and utilities to help you level up your NestJS applications 🚀
MIT License
2.31k stars 270 forks source link

After updating the library, the application on NestJs stopped starting #882

Open AntonBozhenko opened 4 days ago

AntonBozhenko commented 4 days ago

Previously, in some of our projects, both in the dev environment and locally, we did not connect to real data but used random strings (in RMQ_USERNAME, RMQ_PASSWORD, RMQ_HOST). The application would start and display errors in the console. However, after the latest update (5.6.1), the application fails to start entirely. The configuration settings are provided below.

export const RmqConfig: RabbitMQConfig = {
  uri: `amqp://${process.env.RMQ_USERNAME}:${process.env.RMQ_PASSWORD}@${process.env.RMQ_HOST}`,
  connectionInitOptions: { wait: false },
  exchanges,
  queues,
  channels: {
    'main-channel': {
      prefetchCount: 1,
      default: true,
    },
  },
  enableControllerDiscovery: true,
};
@Module({
  imports: [RabbitMQModule.forRoot(RabbitMQModule, RmqConfig)],
  exports: [RabbitMQModule],
})
export class RmqModule {}
underfisk commented 4 days ago

@AntonBozhenko Are you able to include the error messages that you see, the reproduction above looks correct but I don't know what errors were talking about here

AntonBozhenko commented 3 days ago

@underfisk The screen shows the start of the application on library version 5.3.0

Снимок экрана 2024-11-15 в 10 03 09

With library version 5.6.1 the error is the same, but the application does not start. The error occurs because my local RabbitMq server is not running. It looks like connectionInitOptions: { wait: false } is not working.

underfisk commented 3 days ago

@AntonBozhenko Are you able to identify if in the previous version 5.6.0 this still happens? I'd like to understand when this started happening

AntonBozhenko commented 3 days ago

@underfisk on version 5.4.0 everything is fine, but on all newer versions the application does not start

miccies commented 9 hours ago

I belive that there is an issue in

https://github.com/golevelup/nestjs/blob/6ca2d162ac6c293b7c620a9e493bd2032df8f64b/packages/rabbitmq/src/amqp/utils.ts#L32

The / is not escaped, I belive it should be changed to

/^amqps?:\/\/(([^:]+):([^@]+)@)?([^:\/]+)(:[0-9]+)?(\/.*)?$/;