Skip to main content

Building actions

A guide to building client-side and server-side actions in Bubble plugins — covering action types, field definitions, node module support, and limitations around file sizes and option sets.

Written by Sofia Maconi

System hard limits

When creating plugins for Bubble, it's important to be mindful of Bubble's hard system limits. These constraints for plugin development mirror those in general Bubble development. The article below covers this subject:

Article: Hard limits

Building actions is quite similar to building elements. You add them to your plugin and test them the same way, using a test app. Web actions are written in JavaScript, and mobile actions in React Native.

Action types

There are two types of actions you can build: client-side and server-side.

Defining an action

As with elements, you define the action's fields, then use those values in your code through the properties object. See the previous article for the field options available when adding fields to an element or action.

The core of the action is the function that runs when a workflow reaches it. This function is called with the properties and context objects. You can see contextual documentation for both in the editor. If your action references an imported React Native library, you access it through context as well.

As with element functions, keep in mind that your code may run more than once to fetch data. It's best to load data at the start of your functions, before modifying any state outside the function. See the next article for more.

Here's an example of an action that sends data to Facebook Pixel:

Using node modules in a server-side action

You can extend a server-side action's functionality with node modules. Select This action uses node modules, then paste your package.json into the box that appears. You can also list modules by hand; only the dependencies section is used. Require your modules inside your function as you normally would.

When you add or update your list of modules, Bubble builds a deployment package to run your action. This can take a few minutes, and you start it by clicking the link that appears below the box.

Notes and limitations

File sizes

File inputs. Server-side plugin actions encode files using base64, which increases file size by roughly 1.25x. Try to avoid passing files larger than 5MB through server-side plugin actions. File URLs are a good alternative to file inputs.

API call response size. There's a hard limit of 50MB for responses to an outgoing API call made with a plugin (this includes the API Connector). Exceeding it generates an error in the logs: "response too large."

Option sets

Option sets can't be retrieved through server-side actions. Client-side, an option set is represented as a { listProperties, get } object, where listProperties lists all the fields on the option, and get('field') gets the value of that field on the option set.

Did this answer your question?