# How to test a Server Side plugin?

**URL:** <https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542>\
**Category:** Plugins\
**Created:** [April 28, 2019, 11:51am UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542 "2019-04-28T11:51:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 28, 2019, 11:51am UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/1 "2019-04-28T11:51:39Z")

</div>

Or rather … how do I see the output from the plugin running ?

At the moment it does … nothing. But I can’t see what error it is producing.

Plugin is setup, and is firing from the test app … but then no response.

Any thoughts ?

---

<div class="post-metadata">

**Author:** ![sudsy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sudsy/32/114637_2.png) [@sudsy](https://forum.bubble.io/u/sudsy)\
**Post date:** [April 28, 2019, 12:27pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/2 "2019-04-28T12:27:49Z")

</div>

I’ve not yet tried it myself, but I did come across [this](http://forum.bubble.io/t/plugins-for-beginners-accessing-input-and-output-fields-in-plugin-action-javascript-code/48309/28) and [this](http://forum.bubble.io/t/plugin-server-side-action-console-output/54357/2).

---

<div class="post-metadata">

**Author:** ![JonL](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@JonL](https://forum.bubble.io/u/JonL)\
**Post date:** [April 28, 2019, 2:24pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/3 "2019-04-28T14:24:37Z")

</div>

console.log(String);

It will output the log in the workflow log system.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 28, 2019, 3:52pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/4 "2019-04-28T15:52:01Z")

</div>

Thanks. But where 🙂

---

<div class="post-metadata">

**Author:** ![JonL](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@JonL](https://forum.bubble.io/u/JonL)\
**Post date:** [April 28, 2019, 4:06pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/5 "2019-04-28T16:06:47Z")

</div>

In the code of the server side action of the plugin.

If you want to test it out quickly and see how the log looks like use the ssa from Misha’s toolbox.

Or you mean the verbose output of the error you think the plugin is spitting?

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 28, 2019, 4:11pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/6 "2019-04-28T16:11:46Z")

</div>

I am not sure what I mean 🙂

> client.post(‘statuses/update’, status, function(error, tweet, response) {  
> if (!error) {  
> return {  
> out: JSON.stringify(response)  
> }  
> }else{  
> console.log(error)  
> }

Nothing appears in either the Bubble Log or the Console Log … so not quite sure what I am doing wrong.

---

<div class="post-metadata">

**Author:** ![JonL](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@JonL](https://forum.bubble.io/u/JonL)\
**Post date:** [April 28, 2019, 4:21pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/7 "2019-04-28T16:21:40Z")

</div>

If it’s a SSA you can discard completely finding something in the browser console.

I’m on mobile so I can’t send you a screenshot of how it looks in the logs tab. I can say it looks ugly and it is in the middle of a long string. I think also that with the last change you can now filter in the logs tab so you can only see the strings that have a console.log output.

What I am saying is that you may be missing the console log because the log is empty and in the middle of a string of gibberish.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 28, 2019, 4:23pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/8 "2019-04-28T16:23:28Z")

</div>

Plugin server side action console output

START RequestId: 603be3e7-cc98-4d8b-a06d-f2adaa1bb6c5 Version: $LATEST END RequestId: 603be3e7-cc98-4d8b-a06d-f2adaa1bb6c5 REPORT RequestId: 603be3e7-cc98-4d8b-a06d-f2adaa1bb6c5 Duration: 241.76 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 73 MB

---

<div class="post-metadata">

**Author:** ![JonL](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@JonL](https://forum.bubble.io/u/JonL)\
**Post date:** [April 28, 2019, 4:32pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/9 "2019-04-28T16:32:15Z")

</div>

Yeah that is the one. There doesn’t seem to be an error there.

Change the console.log(error) to console.log(“this is a console log”) and it should not print anything.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 28, 2019, 4:33pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/10 "2019-04-28T16:33:40Z")

</div>

Aha, so it may not be erroring, it may just not be “working”.

---

<div class="post-metadata">

**Author:** ![mebeingken](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mebeingken/32/20139_2.png) [@mebeingken](https://forum.bubble.io/u/mebeingken)\
**Post date:** [April 28, 2019, 5:16pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/11 "2019-04-28T17:16:17Z")

</div>

Oh, if I had a nickel for every time I said that!

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 28, 2019, 6:25pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/12 "2019-04-28T18:25:45Z")

</div>

For reasons unknown it just skips all the way through until the line before the last }

---

<div class="post-metadata">

**Author:** ![sudsy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sudsy/32/114637_2.png) [@sudsy](https://forum.bubble.io/u/sudsy)\
**Post date:** [April 28, 2019, 6:48pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/13 "2019-04-28T18:48:14Z")

</div>

The closing “}” is missing.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 29, 2019, 7:28am UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/14 "2019-04-29T07:28:05Z")

</div>

Is there anything I can stuff the JS into to give a visual representation of the structure ?

There are too many }s for my limited skill.

---

<div class="post-metadata">

**Author:** ![JonL](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@JonL](https://forum.bubble.io/u/JonL)\
**Post date:** [April 29, 2019, 7:41am UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/15 "2019-04-29T07:41:07Z")

</div>

A missing } or any other syntax error would most probably spit something in the browser Bubble debugger box in debugging mode.

---

<div class="post-metadata">

**Author:** ![antony](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/antony/32/19446_2.png) [@antony](https://forum.bubble.io/u/antony)\
**Post date:** [April 29, 2019, 12:22pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/16 "2019-04-29T12:22:57Z")

</div>

Hey Nigel…

I use notepad ++ on a pc which helps you see your bracket levels…

Then I used various online tools for syntax checking like is jslint…

And also created a client side equivalent of my plugin (so one done with an _element_) and found a way to easily swap code between the client and server side version… Then with the client side one I had easy console.logging and an almost accurate description of the line number that was causing the problem… and of course for testing, it executes in milliseconds rather than nearly 12 seconds! Here is the code framework:

```
function(instance, properties, context) {
var actiontype = "element"; // element or server
// Function call for element:
// function(instance, properties, context) {
// Function Call for server:
// function(properties, instance) {  
 
// GET the single item inputs but only needed if running on the server.
if (actiontype == "server") {
  if(properties.this_input) {properties.this_input.get();} 
  // etc etc
}

////////////////////////////////////////
// DO ALL YOUR FUNKY JAVASCRIPT WORK...
////////////////////////////////////////

//Output
  
if (actiontype == "element") {
  instance.publishState("this_output", this_output_value);
  // etc etc
}
  
if (actiontype == "server") {
  return {"this_output":this_output_value};

```

}

Couple of things to look out for:

1. The first line with the function call needs to be absolutely the same text as Bubble provides, without a space or anything different.
2. The line number with the problem when testing the element based client side version is the number shown in the anonymous bit of the message -2!

Good luck!  
Antony. 🙂

---

<div class="post-metadata">

**Author:** ![jarrad](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jarrad](https://forum.bubble.io/u/jarrad)\
**Post date:** [April 29, 2019, 12:53pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/17 "2019-04-29T12:53:43Z")

</div>

What do you log if you try this,

```auto
client.post(‘statuses/update’, status, function(error, tweet, response) {
if (!error) {
console.log({error: error, tweet: tweet, response: response});
return {
out: JSON.stringify(response)
}
}else{
console.log(error)
}
```

---

<div class="post-metadata">

**Author:** ![sudsy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sudsy/32/114637_2.png) [@sudsy](https://forum.bubble.io/u/sudsy)\
**Post date:** [April 29, 2019, 2:53pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/18 "2019-04-29T14:53:10Z")

</div>

> [@NigelG](#):
>
> Is there anything I can stuff the JS into to give a visual representation of the structure ?

Hey @NigelG, I discovered that pressing **Shift+Tab** auto-formats selected code, making it easier to identify unbalanced code blocks.

![bubble-code-format](https://us1.discourse-cdn.com/bubble/original/3X/2/4/243eba51d956cdb646a8645c91a7626687ab42ac.gif)

(Also note the disclosure triangles to the left which expand/collapse blocks of code.)

That said, while it’s definitely handy to have some limited syntax highlighting, code formatting, and code completion directly in the browser, there’s no substitute for a full-featured IDE. (Hard to imagine a time when “real coders” developed software without the aid of such tools!) Unfortunately, it’s not easy to integrate an external IDE into a Bubble plugin dev workflow in my experience. If anyone has found a good approach, I’d be interested to hear about it.

---

<div class="post-metadata">

**Author:** ![antony](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/antony/32/19446_2.png) [@antony](https://forum.bubble.io/u/antony)\
**Post date:** [April 29, 2019, 3:46pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/19 "2019-04-29T15:46:20Z")

</div>

Hi again Nigel… I just updated my post above to include the code! 🙂

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [April 29, 2019, 4:34pm UTC](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542/20 "2019-04-29T16:34:37Z")

</div>

> [@sudsy](#):
>
> Hard to imagine a time when “real coders” developed software without the aid of such tools!)

I used to code on a coding “sheet” and hand test it. Because the compiler only ran overnight and you didn’t want a syntax error at 9am if you had to wait 24 hours 🙂

[Next page](https://forum.bubble.io/t/how-to-test-a-server-side-plugin/55542.md?page=2)
