Toolbox ServerScript won't return anything and I don't know why

Hi,
I need to build an API backend workflow that runs a small javascript function. For this I am using Toolbox “Server Script”.
It seems that it won’t return anything and all my actions in the workflow that rely on the ServerScript result don’t work.

I have simplified at the very maximum the script to find my error but still it won’t work.

Please see on the attached screenshot how I’ve setup the ServerSide action

Any help would be highly appreciated.
Best

put a console.log statement to output your thingslist1[0] at the start and then look at the server logs. You will have to tick on server side output in the advanced section of your server logs

Hi paul29, thanks for your message

Here is the console.log(properties.thinglist1[0]) output :

Here is the console.log(properties.thinglist1) output :

I can’t understand what’s happening here

Can you sandwich the console.log(properties.thinglist1[0]) in two log statements with static text?

i.e.
console.log(‘start’);
console.log(properties.thinglist1[0]);
console.log(‘finish’);

Bubble server log output is very hard to read. It looks like it’s undefined but just to be sure I’m looking at the right thing. If it is, this is why you aren’t receiving a return statement which means the issue is with your data

1 Like

Thanks again for your support, please see here the sandwiched output (between the orange and blue stuff)
properties.thinglist1;

properties.thinglist1[0];

The JSON object you want is within _source. So _pointer._source

const data = JSON.parse(properties.thingyOfDoom);
const thing1 = data._pointer._source.thingymabopper;

@doug.burden Beat me to it. Took me a bit to remember.

@bonjour_17 This will also help

Toolbox plugin help - server script - Need help / Plugins - Bubble Forum

Thanks, that was it. This was tricky to find, even with your answer it took me quite some time to make it work.

Best to you and paul

1 Like