MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API

Home Page:https://mrrefactoring.github.io/jira.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"ReferenceError: URL is not defined" when OAuth 1.0 is in use

iovecoldpizza opened this issue · comments

Environment:
Node v8.17.0 & MeteorJS v1.8.1

Brief situation:
When using OAuth to construct a client (in my case I'm accessing Jira server, instead of Jira cloud) and use it to call any APIs, "ReferenceError: URL is not defined" got thrown.
As a side note OAuth2 connection toward Jira cloud works out of the box.

Steps to reproduce:

  1. Use OAuth to construct either a Version2Client or Version3Client (Jira Server is used for my case )
  2. Make any API calls
  3. "ReferenceError: URL is not defined" will be thrown.

Possible fix:
As suggested by the error message, the URL package is not being imported in /out/services/authenticationService/authentications/createOAuthAuthenticationToken.js. (I'm not sure if it's imported by default in newer Node versions)
Adding const URL = require("url").URL in the file will fix the issue.

p.s. Thanks for the package btw. It saves tons of time constructing raw HTTP requests :)

Hi @AK4702! Thank you for your question. Actually I’m using whatwg URL that was added in NodeJS v10.0.0. And also NodeJS v10.0.0 it is a minimal support verison