How to resolve TypeError: Cannot read properties of undefined

I’m using jira-client to create a jira utility

I split my functions into two files but when I try to execute now I get
TypeError: Cannot read properties of undefined

This is the code

changeStatus: function (issueId, transitionId) {
    return new Promise((resolve, rejects) => {
      if (isString(issueId) && issueId.length === 7 && isString(transitionId)) {
        jira
          .transitionIssue(issueId, {
            transition: {
              id: transitionId,
            },
          })
          .then((transition) => {
            resolve(transition);
          })
          .catch((error) => {
            rejects(error);
          });
      } else {
        rejects(`The request cannot be handled as a result of \n
        The issueId ${issueId} is not valid due to \n
          1. The value passed is not a String \n
          2. The value passed is not of length 7 \n
          or \n
          The transitionId ${transitionId} provided is not string`);
      }
    });
  },
checkStatus: function (issueId) {
    jiraApis
      .checkIssueStatus(issueId)
      .then((issue) => {
        console.log(`Status of the issue is ${issue}`);
      })
      .catch((err) => {
        console.error(err);
      });
  },
jiraApis.checkStatus("<issueId redacted>")

this call results in TypeError: Cannot read properties of undefined (reading 'findIssue')

Any idea why ?

Considering findIssue is a method on the JiraApi instance I would expect it to be defined as long as you have access to the instance.

The code you posted doesn’t really help us. Post a GitHub repo with all the code instead.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.