Registry / crm-productivity / jira-client

jira-client

JSON →
library0.0.10jsnpmunverified

jira-client is an actively maintained, open-source Node.js module that provides an object-oriented wrapper for the Jira REST API. It aims to simplify programmatic interaction with Jira by abstracting HTTP requests into easy-to-use method calls, handling authentication, and parsing responses. The current stable version is 8.2.2. The project generally follows a regular release cadence with patch and minor updates for bug fixes, dependency bumps, and new API method support. Major versions, occurring less frequently, typically introduce breaking changes such as dropping support for older Node.js versions or swapping underlying HTTP client libraries. Its core value lies in offering a consistent, promise-based API for common Jira operations, making it suitable for developing automation scripts, integrations, and custom tools that interact with Jira in a Node.js environment.

npm install jira-client
INSTALL
IMPORT
SIG · JIRA-CLIENT
J
jira-client
crm-productivityjavascriptv0.0.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JiraApi
import JiraApi from 'jira-client';
import { JiraApi } from 'jira-client';
The JiraApi class is exported as a default export in ESM. Attempting a named import will result in 'JiraApi is not a constructor'.
JiraApi
const JiraApi = require('jira-client');
const { JiraApi } = require('jira-client');
In CommonJS, the JiraApi class is the module's default export. Destructuring it will result in an undefined value, leading to 'JiraApi is not a constructor'.
JiraApi client initialization
new JiraApi({ host: 'jira.example.com', username: 'user', password: 'pass' });
new JiraApi('https', 'jira.example.com', 'user', 'pass');
The JiraApi constructor expects a single configuration object with all options (protocol, host, username, password, etc.), not individual positional arguments.

Demonstrates how to initialize the JiraApi client and fetch the status, summary, and assignee of a specific Jira issue using async/await.

import JiraApi from 'jira-client'; import process from 'process'; async function getJiraIssueStatus(issueNumber: string) { // It's crucial to avoid hardcoding sensitive credentials in source code. // Use environment variables or a secure configuration management system. const jira = new JiraApi({ protocol: 'https', host: process.env.JIRA_HOST ?? 'jira.example.com', // Replace with your Jira host username: process.env.JIRA_USERNAME ?? 'your_username', password: process.env.JIRA_PASSWORD ?? 'your_password', apiVersion: '2', strictSSL: true // Set to false if using self-signed certs (not recommended for production) }); try { const issue = await jira.findIssue(issueNumber); console.log(`Issue ${issueNumber} status: ${issue.fields.status.name}`); console.log(`Summary: ${issue.fields.summary}`); console.log(`Assignee: ${issue.fields.assignee ? issue.fields.assignee.displayName : 'Unassigned'}`); } catch (err) { console.error(`Error fetching issue ${issueNumber}:`, err); if (err.statusCode === 401) { console.error("Authentication failed. Check your username and password and ensure proper permissions."); } else if (err.statusCode === 404) { console.error(`Issue ${issueNumber} not found.`); } } } // To run this example, replace 'YOUR-ISSUE-KEY' with a valid Jira issue key // and ensure JIRA_HOST, JIRA_USERNAME, JIRA_PASSWORD environment variables are set // or provide them directly (for testing). getJiraIssueStatus('YOUR-ISSUE-KEY');
Debug
Known issues
breakingNode.js 12 support was officially removed in `v8.0.0`. Projects still on Node.js 12 must either remain on `jira-client@7.x` or upgrade their Node.js environment to version 16 or newer.
fix
Upgrade your Node.js environment to version 16 or newer, or pin your `jira-client` dependency to a version prior to 8.0.0.
affects: >=8.0.0
breakingThe underlying HTTP request library changed from `request` to `postman-request` in `v8.0.0`. This change might affect custom configurations related to proxies, SSL certificates, or advanced request options previously tailored for the `request` library.
fix
Review your `JiraApi` client initialization options and any custom `doRequest` overrides to ensure compatibility with `postman-request`. Consult its documentation for migration details if you leveraged specific `request` features.
affects: >=8.0.0
breakingThe `addIssueToSprint()` method changed its internal API endpoint in `v7.0.0`. While the method signature remains the same, its interaction with the Jira API differs from previous versions.
fix
Test the `addIssueToSprint()` functionality thoroughly after upgrading to `v7.0.0` or higher to confirm it interacts correctly with your Jira instance's API and desired sprint management.
affects: >=7.0.0
gotchaPromise rejections from API calls are not automatically handled and can be 'swallowed' if not explicitly caught, leading to silent failures. This is standard JavaScript Promise behavior.
fix
Always attach a `.catch()` block to your promise chains or wrap `await` calls in `try...catch` blocks to handle potential errors gracefully. For example: `jira.findIssue(...).then(...).catch(err => console.error(err));`
affects: >=1.0.0
gotchaThe `strictSSL` option in the JiraApi constructor defaults to `true`. If your Jira instance uses a self-signed or otherwise untrusted SSL certificate, connections will fail with an SSL error. Setting `strictSSL: false` for production is generally discouraged due to security implications.
fix
If connecting to a Jira instance with a self-signed certificate (e.g., in development), set `strictSSL: false` in the JiraApi constructor options. For production, consider configuring your environment to trust the certificate or using a properly signed, publicly trusted certificate.
affects: >=1.0.0
Errors
Common errors & fixes
Error: self signed certificate in certificate chain
The Jira server is using a self-signed SSL certificate, and the `jira-client` is configured to enforce strict SSL verification (`strictSSL: true`).
fix
For development environments, set `strictSSL: false` in the JiraApi client configuration. For production, ensure your environment trusts the certificate authority (CA) that signed the Jira server's certificate, or configure Jira to use a publicly trusted certificate.
TypeError: JiraApi is not a constructor
The `JiraApi` class was not correctly imported or required, typically due to attempting a named import/destructuring for a default export.
fix
For ESM, use `import JiraApi from 'jira-client';`. For CommonJS, use `const JiraApi = require('jira-client');`. Do not use `{ JiraApi }` in either scenario.
UnhandledPromiseRejectionWarning: Unhandled promise rejection.
A Promise returned by a Jira API method rejected (e.g., due to a network error or a Jira API error response) but was not explicitly handled by a `.catch()` block or `try...catch` statement.
fix
Ensure all API calls are followed by a `.catch()` method or wrapped in a `try...catch` block when using `async/await` to properly handle and log potential errors.
Error: statusCode: 401, data: { errorMessages: [ 'You are not authenticated.' ] }
The provided `username` or `password` for authentication with Jira is incorrect, or the authenticated account lacks the necessary permissions for the requested operation.
fix
Verify the `username` and `password` in your JiraApi client configuration. Additionally, check the permissions of the Jira account to ensure it can perform the desired actions.
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies
postman-requestrequiredInternal HTTP client library for making requests to the Jira API. Replaced 'request' in v8.0.0.
nanoidrequiredInternal utility for generating unique IDs, used within the client's operations.
Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources