MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API
https://mrrefactoring.github.io/jira.js/
MIT License
349 stars 46 forks source link

Migration Errors from `jira.js` `2.19.1` to `3.0.5` #311

Closed MrRefactoring closed 1 month ago

MrRefactoring commented 2 months ago

Hi,

Is there a guide on how to migrate from jira.js version 2.19.1 to 3.0.5? After updating the version and running my project, I encounter several errors related to bad requests and incorrect project specifications. Here are some of the errors I'm seeing:

Below is an example of how I'm currently using jira.js:

const client2 = new Version2Client({
  host: process.env.RM_JIRA_URI,
  newErrorHandling: true,
  telemetry: false,
  rejectUnauthorized: false,
  authentication: {
    basic: {
      username: process.env.RM_JIRA_USERNAME,
      password: process.env.RM_JIRA_PASSWORD
    }
  }
})

async function isVersionInProjectNew(fixVersion, projectToCheck) {
  const project = { projectIdOrKey: projectToCheck }
  const versions = await client2.projectVersions
    .getProjectVersions(project)
    .then(res => {
      if (res.errorMessages && res.errorMessages.length >= 0) {
        throw res
      }
      return res
    })
    .catch(error => {
      logger.error('failed to load isVersionInProject', error)
      return []
    })

  let versionsForFixVersion = []
  if (versions) {
    versionsForFixVersion = versions.filter(v => v.name === fixVersion).map(v => {
      logger.info('Fixversion ' + fixVersion + ' exists in project: ' + projectToCheck + ' - ' + v.description + '.')
      return v
    })
  }

  return versionsForFixVersion.length > 0
}

Could anyone provide insights or documentation on proper migration steps?

Thanks!