I just started building my first Bubble plugin. I’m developing a server side action, however the documentation that is available is not very clear to me. I’m looking for the following information:
List item What is the server runtime environment?
List item Which Javascript libraries / functions are available to be used?
List item How can I pass error and logging information back to my workflow?
List item How can I return an array of objects that can be processed in my workflow?
List item How can I read from files that are stored in Bubble?
List item How can I make requests to external web services from the action, and what are the restrictions (if any)?
I would be more than happy to write this up as an addition to the existing documentation if this is desired. It helps me when learning something new to write it down step-by-step.
I’m a little bit further in my own exploration of server side actions. I was able to get more information on the runtime environment by using the node.js ‘process.versions’ command:
We’re still waiting on @emmanuel to expand on this point:
We currently don’t expose libraries, but we’re looking into ways to add them on request or let people add them themselves.
Answered in detail …
Once you’ve picked this type for the action, you’ll be able to define what kind of data the action should return. It should return a flat JSON object, and you need to define first the keys and types for each key/value pair.
To summarise, you return a JSON object, and any of the values inside it can be a list (array) if defined first to be one.
Answered over several posts, including …
And yes, the request object is the one from node.
You’re getting closer to all your questions being answered, better think up some more! : )
Thanks for the additional info! I’m indeed getting closer to my answers thanks to your help. In reply to some of your comments:
I notice that it isn’t possible to use ‘require’ to load any nodejs modules. So this really limits what can be done server side. I’m trying to read a file that is passed as a parameter to the plugin, however I can’t do anything with it!
This doesn’t allow returning an array of objects as ‘object’ is not a return type in the plugin editor. Unfortunately this is the functionality I’m looking for as I want to parse a file on the server, and then extract a list of objects from it and return it to the workflow.
If you have any thoughts / insights on this it would be greatly appreciated.
Did you ever find a solution for this? I’ve had to solve this problem for parsing and then storing data from PDFs in a Server Action (no external services).