# Split is suddenly not recognised as a function

**URL:** <https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117>\
**Category:** Help Hub\
**Created:** [March 2, 2018, 12:02pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117 "2018-03-02T12:02:16Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [March 2, 2018, 12:02pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/1 "2018-03-02T12:02:17Z")

</div>

Hi,

I have a string.split line in my postman test which has been working fine until today:  
“LocaleArch = pm.environment.get(“bucket3”).split(”,");"

, in fact until late this morning, when I am suddenly being informed:  
“TypeError: pm.environment.get(…).split is not a function”

What could have happened?  
How do I get back to my happy state that split gave me?

---

<div class="post-metadata">

**Author:** ![dhoyt](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dhoyt/32/238_2.png) [@dhoyt](https://community.postman.com/u/dhoyt)\
**Post date:** [March 2, 2018, 3:45pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/2 "2018-03-02T15:45:39Z")

</div>

@GIGAMAC

try …

```javascript
LocaleArch = (pm.environment.get("bucket3")).split(",");

```

---

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [March 2, 2018, 5:55pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/3 "2018-03-02T17:55:05Z")

</div>

nope - sorry - same pain, but thanks for the tip - it looked sensible…  
The only thing I can think of is a change of javascript use by postman somehow.  
I started using regexstr.exec() and some other functions I hadn’t used today, and from today the way i can work with strings seems to have changed along with that - I was working more in line with the reference material in mozilla, and now its more like the reference in ww3 schools…

dont know if this makes sense…

---

<div class="post-metadata">

**Author:** ![dhoyt](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dhoyt/32/238_2.png) [@dhoyt](https://community.postman.com/u/dhoyt)\
**Post date:** [March 2, 2018, 6:17pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/4 "2018-03-02T18:17:33Z")

</div>

@GIGAMAC

I am using split in some of my tests so I went back and looked at how I am using it …

```javascript
var new_titles = pm.environment.get("newTitles").toString().split(',');

```

I just ran the test and it’s working just fine.

Also, you might want to check your version of newman … \> newman -v

Mine is … 3.9.3

---

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [March 5, 2018, 9:27am UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/5 "2018-03-05T09:27:52Z")

</div>

I don’t know if postman is running Newman under its covers (it doesn’t look like it but tbh I am not savvy like that), but I tried this and it worked fine - thanks!

(Given Newman came into the conversation I will look it up and pay more attention to it - thanks also)

---

<div class="post-metadata">

**Author:** ![o.haistruk](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@o.haistruk](https://community.postman.com/u/o.haistruk)\
**Post date:** [March 23, 2018, 8:47am UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/6 "2018-03-23T08:47:04Z")

</div>

Hi! Had the same problem. All work with the single request but throw Type Error in Collection run.  
For such code.

```
let betsString = pm.environment.get("bets");
let betArr = betsString.toString().split(',');

```

After update to v6.0.10 was the same problem. But there was such message in console “Could not find on CollectionStore. Missing or invalid parameter.”

Then I save this request like a new one and delete old. And all works now. Don’t know where the problem was exactly but probably it will help someone. 😀

---

<div class="post-metadata">

**Author:** ![postman-harryi3t](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-harryi3t/32/947_2.png) [@postman-harryi3t](https://community.postman.com/u/postman-harryi3t)\
**Post date:** [March 23, 2018, 5:24pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/7 "2018-03-23T17:24:41Z")

</div>

@o.haistruk Maybe the value is not string. Can you try this

```javascript
console.log(typeof pm.environment.get('bucket3'))

```

Does it print string? I guess not.

---

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [March 24, 2018, 9:33am UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/8 "2018-03-24T09:33:20Z")

</div>

I haven’t done that, but its a fair shout - would be worth a try as a debug step for when a problem occurs. Further,m typeof isn’t obviously available when you trawl through postman documentation, which by the way blows hot and cold for me.

My problem was though that the postman script behaviour had changed - it was working fine then it stopped working and I had to rethink - given I had typed the variable in by hand every time, the fact that it wasn’t being INTERPRETED as an array where it had been previously was a behaviour change, so I had to change the test instruction to deal with it.

---

<div class="post-metadata">

**Author:** ![shamasis](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/shamasis/32/53_2.png) [@shamasis](https://community.postman.com/u/shamasis)\
**Post date:** [March 24, 2018, 6:31pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/9 "2018-03-24T18:31:56Z")

</div>

Just to add - Both postman and Newman uses common code to run collections.

---

<div class="post-metadata">

**Author:** ![o.haistruk](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@o.haistruk](https://community.postman.com/u/o.haistruk)\
**Post date:** [March 27, 2018, 4:03pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/10 "2018-03-27T16:03:19Z")

</div>

@postman-harryi3t Yes! You are right. it was not string. I thought that it is string probably because of view in environment variables panel.

---

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [March 28, 2018, 9:16am UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/11 "2018-03-28T09:16:43Z")

</div>

ok I need to add to this now…  
I started using myArray = pm.environment.get(“varname”).toString().split(“,”);  
as this worked for me on my machine (Mac) in the workspace window, and in a collection run using the environment variables.

A colleague used this same collection and got different results on his (Windows) machine such that:

- Running from workspace was fine
- Running as a collection using the same environment causes a run halt and undefined error.  
There is clearly an inconsistency.

---

<div class="post-metadata">

**Author:** ![vcardenas](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@vcardenas](https://community.postman.com/u/vcardenas)\
**Post date:** [January 21, 2019, 12:25pm UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/12 "2019-01-21T12:25:23Z")

</div>

It works. Thank you.

---

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [January 22, 2019, 8:00am UTC](https://community.postman.com/t/split-is-suddenly-not-recognised-as-a-function/1117/13 "2019-01-22T08:00:09Z")

</div>

Glad it helped - u r welcome
