Plugin code, context.async how does it work

Im working on my first plugin for a bubble application. The plugin creates an account on a remote platform and returns the result (id of the created object) for later processing.

I’m currently faced with an error when testing the plugin: “Plugin action ACTIONNAME error:
2019-02-04T12:05:32.960Z 37cc601a-9fa6-4a8a-9d87-96435f35e6bb Task timed out after 10.00 seconds”

Sometimes the object has been created, sometimes not…

This is my plugin code:

function(properties, context) {
  	var return_object = {
      auth0_user_id: null,
      status: 'open',
      success: false
    var ManagementClient = require('auth0').ManagementClient;
    var auth0 = new ManagementClient({
      domain: context.keys.apiSubdomain + '',
      clientId: context.keys.client_id,
      clientSecret: context.keys.client_secret,
      scope: 'read:users update:users create:users'

    var userData = {
      connection: "Username-Password-Authentication",
      password: properties.plain_password,
      user_metadata: {},
      blocked: false,
      email_verified: false,
      verify_email: false,
      app_metadata: {},
      given_name: properties.first_name,
      family_name: properties.last_name

    context.async(function(err, res) {  
        .then(function(backval) {
            return_object.auth0_user_id = backval.user_id;
            return_object.status = "success";
            return_object.success = true;
        .catch(function(err) {
            console.log(, err.message, err.statusCode);
            return_object.status = "error: " + + ", " + err.message + ", " + err.statusCode;

    return return_object;

Just wanted to respond to this 2-month-old post to say that @Kfawcett, with the help of some JS gurus, managed to work this out.


Why none of these things are spelled out in the guide baffles me.