amqp / rhea

A reactive messaging library based on the AMQP protocol
Apache License 2.0
275 stars 79 forks source link

Authenticate solace using amqp10 #423

Open jaymsf opened 1 week ago

jaymsf commented 1 week ago

Currently I have setup solace on my private url. I want to connect to a particular VPN using some authentication, but I am unable to connect currently. I am able to connect with passing just host and port.

const container = rhea.create_container()
    container.options.username = "admin"
    container.options.password = "Test@123"
    this.connection = container.connect({
      host: process.env.AMQP_HOST,
      port: Number(process.env.AMQP_PORT),
      container_id:"test",
      // transport:"tls",
      // servername:"test",
      // properties: {
      //   target: "test",
      // },
      // hostname:"amqp",
      username:"admin",
      password:"Test@123",
    });

Getting error while trying to pass credentials

Error connecting to Solace: ConnectionError: No suitable mechanism; server supports ANONYMOUS
    at Connection._handle_error (/node_modules/rhea/lib/connection.js:479:36)
    at Connection.sasl_failed (/node_modules/rhea/lib/connection.js:454:10)
    at SaslClient.on_sasl_mechanisms (/node_modules/rhea/lib/sasl.js:289:25)
    at c.dispatch (/node_modules/rhea/lib/types.js:948:33)
    at Transport.read (/node_modules/rhea/lib/transport.js:117:36)
    at SaslClient.read (/node_modules/rhea/lib/sasl.js:346:31)
    at Connection.input (/node_modules/rhea/lib/connection.js:567:37)
    at Socket.emit (node:events:517:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:368:12) {
  condition: "amqp:unauthorized-access",
  description: 'No suitable mechanism; server supports ANONYMOUS'
  }
grs commented 1 week ago

The error message suggests that the server is not accepting authentication with a username and password. (You may need to enable TLS for that). I would advise contacting support for the server if you think this is not correct.

jaymsf commented 1 week ago

I am able to connect to solace without authentication but it connects to the default VPN, I want to connect to another custom VPN.

Does anybody know what are the steps to do it?