title: amqplib sendToQueue() is not sending messages to RabbitMQ
body: <p>I am building a Typescript package around <code>amqplib</code>'s Promise API to make it simpler for me to send messages between two RabbitMQ queues.</p>
  <p>This is a method inside a class of said package that is responsible for sending a message to RabbitMQ. It's not actually sending messages, because I can't see them from CloudAMQP.</p>
  <pre><code>class PostOffice {
      connection: any;
  
      constructor(connection: any) {
          this.connection = connection;
      }
  
      //...
  
      // TMQMessage is an object that can be trivially serialized to JSON
      // The Writer class holds the channel because I'm having trouble
      // making Typescript class member updates stick after a method returns.
      async send(writer: Writer, message: TMQMessage) {
          //...RabbitMQ code begins here
          let channel = writer.stageConsume[0]; // This channel is created elsewhere
          
          // Queue is created here and I can see it in CloudAMQP.
          await channel.assertQueue(message.to + &quot;/stage/1&quot;, {
              durable: true,
          }); // `message.to` is a string indicating destination, e.g. 'test/hello'
          
          // According to docs, the content should be converted to Buffer
          await channel.sendToQueue(message.to + &quot;/stage/1&quot;, Buffer.from(JSON.stringify(message)));
          
          channel.close()
      }
  
  }
  </code></pre>
  <p>This is a class I made that creates connections and channels, which is being used here:</p>
  <pre><code>import { Writer } from &quot;./Writer&quot;;
  
  export class ConnectionFactory {
      url: string;
      amqp: any;
      constructor(url: string) {
          this.url = url;
          this.amqp = require('amqplib');
      }
  
      async connect(timeout: number = 2000) {
          let connection = await this.amqp.connect(this.url, {
              // timeout for a message acknowledge.
              timeout, // Make the timeout 2s per now
          })
          return connection;
      }
      async createChannels(connection: any, writer: Writer) {
          //... relevant code starts here
          let stageChannels = [];
          stageChannels.push(await connection.createChannel())
          writer.stageConsume = stageChannels;
          return writer;
      }
  }
  </code></pre>
  <p>}</p>
  <p>My connection factory seems to be working properly, because I can see the connections from CloudAMQP's dashboard. Also I can see the Queues that have been created (asserted in my code) from the dashboard too. However, I am unable to get amqplib to send a message out to CloudAMQP.</p>
  <p>Here's the (async) code I'm using to call my package:</p>
  <pre><code>let Cf = new ConnectionFactory(url)
  let connection = await Cf.connect()
  let writer = new Writer();
  
  let message: TMQMessage = {
      //... message content in JSON
  }
  
  writer = await Cf.createChannels(connection, writer)
  let po = new PostOffice(connection)
  await po.send(writer, message)
  </code></pre>
  <p>What seems to be wrong?</p>