Flow Designer Error: Cannot read property "length" from undefined

VibertT
Tera Contributor

Hello,

I have a Flow that creates GitLab Issues for specified projects.  If the project does not exist (new software is requested) then it directs the Issues to a catch-all project.  I am receiving Error: Cannot read property "length" from undefined when trying to direct the issue to the catch-all project, but not when the project is specified.  

 

Error:

VibertT_0-1739896289921.png

 

GitLab Project ID is known: (works)

VibertT_1-1739896352484.png

 

GitLab Project ID the catch-all project: (does not work)

VibertT_2-1739896373481.png

 

Am I not allowed to use a hard-coded project ID?

3 REPLIES 3

Community Alums
Not applicable

I have read through this and compared it to the pre-processing script for Create Issue with GitLab, and it does not contain .length

 

(function execute(inputs, outputs) {
    var mandatoryInputs = {};
    mandatoryInputs.project_id = inputs.project_id;
    mandatoryInputs.title = inputs.title;
    new GitlabUtils().checkIfEmpty(mandatoryInputs);
  
    var urlParams = {};
    urlParams.project_id = inputs.project_id;
    new GitlabUtils().validateInputs(urlParams, outputs);
  
    var nameValuePairs = inputs.fields.split('^');
    var nameValues = nameValuePairs.reduce(function(map, pair) {
        var tokens = pair.split('=');
        map[tokens[0]] = tokens[1];
        return map;
    }, {});
    nameValues.project_id = inputs.project_id;
    nameValues.title = inputs.title;
    if (inputs.issue_iid)
        nameValues.iid = inputs.issue_iid;
    outputs.payload = JSON.stringify(nameValues);
})(inputs, outputs);

 

I have read through this page. It mentions that .length was being called in the pre-processing script.  I've gone through the pre-processing script for Create Issue with GitLab and it does not contain .length

(function execute(inputs, outputs) {
    var mandatoryInputs = {};
    mandatoryInputs.project_id = inputs.project_id;
    mandatoryInputs.title = inputs.title;
    new GitlabUtils().checkIfEmpty(mandatoryInputs);
  
    var urlParams = {};
    urlParams.project_id = inputs.project_id;
    new GitlabUtils().validateInputs(urlParams, outputs);
  
    var nameValuePairs = inputs.fields.split('^');
    var nameValues = nameValuePairs.reduce(function(map, pair) {
        var tokens = pair.split('=');
        map[tokens[0]] = tokens[1];
        return map;
    }, {});
    nameValues.project_id = inputs.project_id;
    nameValues.title = inputs.title;
    if (inputs.issue_iid)
        nameValues.iid = inputs.issue_iid;
    outputs.payload = JSON.stringify(nameValues);
})(inputs, outputs);