title: I am awaiting for a return Promise from a class method from a module i am creating and i get it, but in a weird context. How can i await it properly?
body: <p>So I am creating a module with a class method(<strong>schedule</strong>) with async function awaiting the return</p>
  <pre><code>//SCHEDULER.JS//
  
  class Schedule {
    constructor(project_id, queue_id) {
      this.project_id = project_id;
      this.queue_id = queue_id;
    }
  
  
    //ASYNC METHOD 1
    schedule = async (date, rquest) =&gt; {
  
      const project = this.project_id;
      const queue = this.queue_id;
      const location = &quot;us-central1&quot;;
      const url = rquest.url;
      const payload = rquest.body;
  
      // Construct the fully qualified queue name.
      const parent = client.queuePath(project, location, queue);
  
      const task = {
        httpRequest: {
          httpMethod: rquest.method,
          url,
          headers: rquest.headers,
        },
      };
  
      try {
        const request = await { parent, task };
        const [response] = await client.createTask(request);
   
        console.log(&quot;&lt;THIS IS THE PROJECT ID&gt; :&quot;, response.name);
        return `${response.name}`;
      } catch (error) {
        console.log(&quot;we have an error amigo!&quot;, error);
      }
    };
  
  
    //ASYNC METHOD 2
    delete = async (one) =&gt; {
      return console.log(&quot;delete function&quot;, one);
    };
  </code></pre>
  <p>I imported my module on main.js and used my method. Once the results returns, I need to use it as a parameter to another method(delete) on the module I created(Scheduler.js).</p>
  <pre><code>//main.js//
  
  const task_id = scheduler.schedule(date, request);
  
  scheduler.delete(task_id);
  
  </code></pre>
  <p>task_id is returning a promise and I can't execute scheduler.delete(task_id) because it is pending promise still.</p>
  <p>Important: How can I handle this promise properly as I am only tasked to create the module and not the main.js. The people who would create the main.js would just be expected to run my methods without handling promise returns.</p>