[New Feature] Server side actions now support node modules

Hello everyone,

We’re adding an exciting new feature we hope will extend considerably what can be done with server side actions in the plugin editor. Server side actions are essentially javascript functions that a plugin can execute in the cloud, and historically they’ve been limited to what can be written in plain javascript without recourse to external libraries.

As of now, it is possible to incorporate whatever node modules you’d like into your server side action. To do so, check the “This action uses node modules” box beneath the action code editor, and paste in or compose your custom package.json. Only the dependencies section is needed. After this, you’ll be prompted to build a deployment package for your action.

Let us know what you think!

38 Likes

Hey @marca: When I click/unclick the “uses node modules” checkbox, I get multiple input fields for dependencies…:

Spotted that ten minutes ago, just pushed the fix.

1 Like

BTW, since we’re talkin’ about server-side stuff: I had this question:

I know this is a big deal, but can someone provide an example of something so new and incredible that’s now possible that wasn’t before?

3 Likes

… wait for it.

2 Likes

I don’t know EXACTLY what’s possible because I have not seen any actual implementations, but just think of real time communications, like real real time, not “real” time, controlling IoT/robotics stuff without a middleman company, create, store and/or send PDF files through email or to another app via API without user interaction… and the list goes on.

That’s what I envision. I mean, someone is making a native app generator… that’s great enough for me.

4 Likes

I can see you developing API PDF interactions for sure and somebody should make a native app generator

2 Likes

@marca, hmm… even code that should be working now is just throwing errors for me like:

(I’m not loading node modules yet.)

… edit: Even when creating a new plug-in and making a trivial server-side action (e.g., just return a static value), I’m getting these errors. In console they show up as:

This too is fixed, as of just now.

1 Like

I’m still seeing it… something special I have to do besides reloading editor(s)?

Sooooo Excited!!!

1 Like

Try once more, and let me know if it’s still a problem?

It’s working again at the moment! Thanks, @marca.

Hey @andrewgassen,

Happy to provide some insight here.

For those who don’t know, Node modules are packages of functions that can be merged into your Node application for use. A simple example is that of Moment, one of the most popular JS libraries to work with dates. There are many reasons why packages see global use, but one of them is if the work done by the few is already functional, portable, usable and most importantly useful. Instead of you investing all the time and energy in building your own set of date functions, you can simply import a package like Moment and off you go.

Despite Bubble offering access to server-side action development (which runs on Node) as well as Request support (one of the most popular HTTP request clients), you weren’t able to import any of the 750K+ modules available therefore being a strict limitation of Bubble plugin development. With the ability to import packages now available to the community, plugin developers (like us) and those looking to develop plugins can do much more in much less, which is what makes this a big deal for all Bubblers. :slight_smile:

17 Likes

Is there a way to use an external editor and then upload/sync with Bubble? Also, how does one go about debugging server-side action code?

Right. And a bunch of my Moment-powered magic (and related utilities) is one of the first things I’m working on.

1 Like

I’m quite familiar with npm and the various node modules floating around, but wasn’t aware there was a limitation before with the Bubble plugin system. This makes sense to me now, and honestly is a bit surprising to me that it’s just now a new thing. I would have assumed this was part of the plugin system from the outset, but I guess I was wrong! Thanks for the clarity.

The main question I have right now about server-side actions, is why are they so damn slow?

A pointless function like:

function(properties, context) {

obj = {
  Response: null
};

return obj;

}

… with an interface that accepts no arguments yields a progress bar that takes nearly 6 seconds to traverse the screen in a tester app (running on free version). And properties and context are required, so you can’t speed things up by trashing them if you don’t need 'em.

Like… really?

1 Like

I get about half that most of the time (around 2.8s), although it’s varied between 1s and 25s.