amqp / rhea

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

Question: amqp:internal-error. The service was unable to process request #303

Open dzmitryieu opened 4 years ago

dzmitryieu commented 4 years ago

Hello! I'm trying to create receiver using "rhea" client. Piece of code: Creating client: const container = require('rhea');

_createClient() {
    if (!this.client) {
      this.log.debug('Creating client');
      this.client = container;
      this.client.on('connection_open', (context) => {
        this.log.info('Connection to queue: OPENED');
        this.connected = true;
      });
      this.client.on('connection_close', async () => {
        this.log.info('Connection to queue: CLOSED');
      });
      this.client.on('error', async (err) => {
        this.log.info('error');
      });
   }
}

Connecting:

  _getAzureConfig() {
    return {
      transport: 'tls',
      host: `${this.settings.host}.servicebus.windows.net`,
      hostname: this.settings.host,
      username: `${this.settings.sasKeyName}`,
      password: `${this.settings.sasKey}`,
      port: 5671,
      reconnect_limit: 5,
    };
  }

async _connect() {
    if (!this.connected) {
      this._createClient();
      const azureConfig = this._getAzureConfig();
      this.log.debug('Connecting to service bus');
      this.connection = await this.client.connect(azureConfig);
    }
  }

Connection opened and works fine until I am creating receiver:

async _createReceiver(subscription, topic) {
const sub = {
      receiver: this.connection.open_receiver({
          source: `${this.settings.topic}/Subscriptions/${subscription}`,
      }),
      connected: true,
      handlers: [],
      topic,
    };
}

And after attemp to open_receiver I get an event "error" with the LinkError:

condition:"amqp:internal-error" description:"The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:5886db3c84d4482184b4541c26efba25_G15, SystemTracker:gateway7, Timestamp:2020-05-15T06:28:17"

Is anybody can help me, how can I get more error details or where can be fault?

grs commented 4 years ago

Do you see this repeatedly? (wondering about 'please retry the operation') If so then for some reason the server is not able to handle the request to create the receiver. Given the error it produces it sounds like something unexpected. Is 'this.settings.topic' definitely set? I also believe servicebus usually requires some sort of claim based security requests. I would have expected a different error for that I think. There is a higher level api/sdk for servicebus that might be worth considering: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/servicebus/service-bus/

dzmitryieu commented 4 years ago

Thanks for quick response! Yes, this.settings.topic definitely set. It happens every time constantly, repeating does not help. I've tried to use azure-sdk-for-js but faced with a lack of opportunity to make CRUD for subscriptions/topics using connectionQuery - this is in development now.

grs commented 4 years ago

setting env var DEBUG=rhea.frames should produce more detail on the protocol level interaction which might show something unexpected and if not would be something you could perhaps use to request info on the error from the servicebus support.