Async method returns {} to http call post

Im trying to call a method using HTTP.call post methid

the method is this and it is a simple method

async 'get-address'(){
return "test"
}

when i call it from postman , i get {}
when i remove async and call it from post man again i get “test”

any idea how to solve this and return

You will need to use Meteor’s webapp package if you want to create a REST API

I already got webapp package running, I’m able to call the method it self and it does return “test”
however when i wrap the method with async, it always returns {},
are you saying that on webapp i can configure this?

You can Meteor.callAsync your method or you can async the function of your method. Example

Meteor.methods({
  get-address: async function (ops, metadata) {
    check(ops, ...)

    // return something    
  }
})

The method get-address will be called using HTTP.call, so on client side i wont be using Meteor.callAsync

Whenever i have async wrapped about a method, the HTTP.call with a post method, alwasy returns {}, once i remove the async, it returns anything i want, i check my http calls using postman

So I made progress with the issue, no solution yet however
This has to do with the fact that HTTP response is receiving a promise as its data, hence it serves it as {} always, something has to do with JSON serializing the result

In my example above I declared a function as async which returns a promise, and in result the data being returned will be converted to {}

If anyone looking for a soultion on how to send a promise over HTTP using Meteor method,
you should use Promise.await and not wrap the function in async, once you wrap the function in a sync and then return await result it will always be {},
use return Promise.await, instead