Not enough toys in function sandbox


#1

I need to POST some HTTP data. The endpoint accepts only application/x-www-form-urlencoded content.

The documentation claims function nodes only allow “base javascript functionality”. The encodeUriComponent() function is not available, yet it has been part of the spec since ES3.

So I have to write a function to do this manually, which is a real pain. Can you whitelist this function (and others like it)?

thanks
Chris


#2

I realize I may have typo’d it; let me try again. Can you provide a list of allowed functionality?


#3

Nope; I apologize, must have typo’d. At any rate, would be happy if you considered making Lodash available–I think that’s pretty safe–but it’s a slippery slope.


#4

We’ve also considered bringing in some Lodash. I’ll create the issue and we’ll begin investigating.


#5

@Brandon_Cannaday

Sorry if this is the wrong thread to re-hash this issue! I was wondering if there is a list of allowed JS in the function block. I’m running into some weird limitations where I think I’m just using base js methods. Thanks!


#6

The function node supports most of the standard built-in objects (things marked as experimental aren’t available). We’ve also whitelisted the Buffer object for binary parsing.


#7

Got it! The debug terminal was (annoyingly) automatically displaying my date string “20170731” as a date object as the output. When I emailed that same value to myself, it appeared as intended, the simple string of numbers.

I assumed it was the JS block was doing something bizarre, but it was actually working fine. Thank you!


#8

The debug output can sometimes be misleading, especially for Date objects. Date objects are automatically displayed as localized strings (based on the browser’s timezone). We thought this would be slightly more useful than just something like “Date Object”. However, this isn’t the first time someone has been confused by date output in Debug tab. Definitely worth some thought on our side to see if there’s a way to make it more clear. If you haven’t suggestions, would love to hear them!