VMware Cloud Community
Subnet88
Enthusiast
Enthusiast

TypeError: Cannot read property "0" from null

Good afternoon.

I am attempting to call four nearly identical workflow runs simultaneously from Wavemaker.  two of them complete successfully, and two of them error out with "TypeError: Cannot read property "0" from null". If I rerun the failed workflows manually, they are successful. The method that the failed workflows error on is "ActiveDirectory.search("UserGroup" , Group);"

Has anybody seen this before?

0 Kudos
10 Replies
Burke-
VMware Employee
VMware Employee

I don't recall seeing this particular error... it may be beneficial to provide additional detail in the form of screenshot(s) and/or attach package with workflow if possible. If you run these simultaneously only from vCO, do they run successfully? Is it ONLY when called from Wavemaker you have the issue?

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Subnet88
Enthusiast
Enthusiast

I have modified my Wavemaker portal to only run 3 at once. Attached is the workflow that is failing.

FailedWF.PNG

WFError.PNG

This also occurs when scheduling three workflow runs at the same time using just VCO

FailedWF_VCO.PNG

0 Kudos
Burke-
VMware Employee
VMware Employee

In "Find Group", try changing this:

var GroupsArray = ActiveDirectory.search("UserGroup" , Group) Usergroup = GroupsArray[0];

to this:

var GroupsArray = ActiveDirectory.search("UserGroup" , Group); if(GroupsArray != null){      Usergroup = GroupsArray[0]; }else{      System.log("No groups named "+Group+" found..."); }

and in Find Users in group, change this:

GroupMembers = Usergroup.userMembers var UsersinGroup = new Array(); var j = 0; for (var i = 0; i < GroupMembers.length; i++) {      UsersinGroup[j++] = GroupMembers[i].name; } Users = UsersinGroup

to this:

if (Usergroup != null){      GroupMembers = Usergroup.userMembers      var UsersinGroup = new Array();      var j = 0;      for (var i = 0; i < GroupMembers.length; i++) {           UsersinGroup[j++] = GroupMembers[i].name;      }           Users = UsersinGroup }

I doubt that this will stop the error from occurring, but at least it may help identify problem areas...

It may also be helpful random delay in the workflow...

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Subnet88
Enthusiast
Enthusiast

I have made the changes. Now, all three runs finish, however two of them come back with "No groups named X found". If I manually re-run either, they come back successful. 

0 Kudos
Burke-
VMware Employee
VMware Employee

Okay, so somehow "X" is being passed to the workflow rather than a valid workflow name? Or did you just put X to hide the actual AD Group that was there? If the latter, no worries - gotta keep proprietary info off public forums Smiley Wink My next step would be to introduce a random sleep duration prior to doing the search...

As a dumbed down attempt to simulate what you're doing, I created a test workflow that launches 5 copies of the "Get Users in Group" workflow at the same time with 5 different group names (1 for each workflow). I looped this to run 5 times... Every instance was successfull in finding the group that I had specified. :smileyconfused:

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Subnet88
Enthusiast
Enthusiast

The X was put there by me :smileygrin:.

Did you run the workflows at the exact same time or sequentially? If I run sequentially, all runs succeed, however if I run workflows on a timer, set to go off at the same time, or from Wavemaker, I run into issues.

0 Kudos
Burke-
VMware Employee
VMware Employee

I used a "Nested Workflow" object to launch 5 at the same time.. after dropping nested workflow onto pallette, you must provide which workflow(s) you wish to execute at the same time... I typically only use this for a single workflow, but you presented me with a use case to run 5 at the same time Smiley Wink

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Subnet88
Enthusiast
Enthusiast

I just tried with a Nested workflow and received the same results as running them via a schedule or via Wavemaker. Are there any logs I could look at that may provide more detailed troubleshooting? Lacking that, how can I add a random sleep to the beginning of the workflow?

0 Kudos
Burke-
VMware Employee
VMware Employee

The following line generates a random number betwee 1 and 60: (multiply by 1000 if using for sleep since sleep time is in millisec)

var i = Math.floor((Math.random() * 60)+1);

If that doesn't work out for you, then you should certainly get in touch with GSS to get support as there seems to be an issue with your vCO. From the vCO Configuraiton Page, there is a section that lets you set your log level. During normal usage, log level should be at Info, Warn, or Error. When preparing a log bundle for GSS, they may ask you to turn up the log level to Debug, perform operations, then generate log bundle. Be sure to turn log level back down after troubleshooting.

Log files are found in <vCO Install folder>/app-server/server/vmo/log

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
cdecanini_
VMware Employee
VMware Employee

Similar code here:

var sleepTime = Math.round(Math.random() * 5000);
System.log("Sleeping for " + sleepTime/1000 + " seconds");
System.sleep(sleepTime);

Will sleep from 0 to 5 seconds.

This is of course a work around. Running at the same time should not be a problem. You may want to open a support request and provide example code to reproduce.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos