# Need help with async server side plugin

**URL:** <https://forum.bubble.io/t/need-help-with-async-server-side-plugin/242868>\
**Category:** Plugins\
**Created:** [January 23, 2023, 12:54am UTC](https://forum.bubble.io/t/need-help-with-async-server-side-plugin/242868 "2023-01-23T00:54:44Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dorilama](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/dorilama/32/226878_2.png) [@dorilama](https://forum.bubble.io/u/dorilama)\
**Post date:** [January 23, 2023, 1:31pm UTC](https://forum.bubble.io/t/need-help-with-async-server-side-plugin/242868/4 "2023-01-23T13:31:52Z")

</div>

The point is that Bubble runs your code in a synchronous way.  
Any code that is asynchronous must be inside `context.async` or it will not be handled by bubble’s logic.  
It doesn’t matter if you use async/await or then/catch.

Example with async/await:

```auto
const result = context.async(async (callback) => {
  try {
    const result = await doStuff();
    callback(null, result);
  } catch (error) {
    callback(error);
  }
});

```

Example with then/catch:

```auto
const result = context.async((callback) => {
  doStuff()
    .then((result) => {
      callback(null, result);
    })
    .catch((error) => {
      callback(error);
    });
});

```

---

_[View the full topic](https://forum.bubble.io/t/need-help-with-async-server-side-plugin/242868)._
