Here almost a year later, but I did notice that context.async
seems to be working now.
Only bumping this incase someone did want to use it; I’d recommend declaring a function within the larger run_server
function:
function(properties, context) {
//...
function myAsyncFunction() {
return context.async(async callback => {
try {
let return_var = "never set in code";
// ...
// do your processing here
// ...
return_var = "something_here"; // update return var
callback(null, return_var);
}
catch (err) {
callback(err);
}
});
}
//...
}
The reason for this is so that you can control when to call the function. The traditional method @vini_brito mentions is probably still good to, but I went with context.async
because I wanted to be sure it would work on Bubble’s backend workflows.