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
366 stars 49 forks source link

Can't connect the jira client #235

Closed IsuruUthpala closed 2 years ago

IsuruUthpala commented 2 years ago

Having trouble connecting to the client.

I'm getting 400 Bad Request and the response body data property is like below. version - "jira.js": "^2.15.9"

{
  data: '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n' +
      '<html><head>\n' +
      '<title>400 Bad Request</title>\n' +
      '</head><body>\n' +
      '<h1>Bad Request</h1>\n' +
      '<p>Your browser sent a request that this server could not understand.<br />\n' +
      '</p>\n' +
      '<hr>\n' +
      '<address>Apache/2.4.29 (Ubuntu) Server at 127.0.1.1 Port 80</address>\n' +
      '</body></html>\n'
  }

This is how i connected to the client.

jiraTicketCLient = new Version2Client({
    host: configuration().app.jira.ticketHost,

    authentication: {
      basic: {
        email: configuration().app.jira.email,
        apiToken: configuration().app.jira.apiToken,
      },
    },
  });

This is my import ;

import { Version2Client } from 'jira.js';

email and the api token are correct and works fine with jira-connector l library

MrRefactoring commented 2 years ago

Hello @IsuruUthpala! Which method you have tried to call?

MrRefactoring commented 2 years ago

And one more thing. Your host started from http:// or https://? If not then try it

IsuruUthpala commented 2 years ago

And one more thing. Your host started from http:// or https://? If not then try it

Silly me, I had the host like below (same way as jira-connector) host: "jenjinstudios.atlassian.net" Thank you @MrRefactoring

IsuruUthpala commented 2 years ago

I'm closing this, Since resolved.

MrRefactoring commented 2 years ago

I think it makes sense to do some kind of check on the library side, so I'll leave this ticket open for now. In any case, thanks a lot for the report, it's useful