TypeError: 'split' is not a function

When you use the Function Editor UI → the function passes when you “Run” it.

However when you call it through the http service, it returns that that error.

Is there 2 different libraries being run?

Hi Chi – This might come down to one of two things –

  • Different inputs to the function when it’s being run in the console/called from a webhook
  • Different permissions for the request. Ex. you may be running as a System user in the console, but te Webhook may be using different permissions.

If you can DM me a link to your application or post information on your function/how you are calling the webhook, I may be able to help you further troubleshoot.

Actually dont worry about the post above, in your documentation it says you dont support ES6 split function. I did a work around.

However, there’s a critical bug I think on your http context.

A simple test will verify that there’s something wrong in the way the system has assigned the form values.
(Critical Stitch Function Bug (context.http.post))

Hi Chi – Mind posting the code that you’re running that produces this error? I just confirmed that the String split is supported in Functions.

I’ve responded to your note on the HTTP service separately.

Hello Drew,

I am trying to send the below data to my mongodb realm http service:

	"care_settings": ["Home Care Agency", "Assisted Living Home", "Nursing Home"],
	"alert_preferences":["Email", "Phone"]

Note that both fields are arrays. The problem is that the payload/payload.body in http service is only accessible as a string. I have taken MongoDB courses whereby the collections have array fields. How can I create a collection of mine with array fields using Mongodb Realm http services/functions?