Unable to authenticate with on-prem Jira

Issue #293 closed
Martin van der Boon created an issue

VS Code version: 1.40.1. with Atlassian plugin version: 2.1.5 on macOS 10.14.6

Attempting to setup a custom Jira (or Bitbucket) site authentication fails with Error: socket hang up

[2019-11-23 07:42:56:087] ----------------------------------------------------------------------
[2019-11-23 07:42:56:087] curl -X GET -H "X-Atlassian-Token:no-check" -H "x-atlassian-force-account-id:true" -H "Content-Type:application/json" -H "Authorization:Basic **********" "https://jira.x.y.com/rest/api/2/myself"
[2019-11-23 07:42:56:087] ----------------------------------------------------------------------
[2019-11-23 07:42:57:234]  Error: Error authenticating with Jira: Error: socket hang up
[2019-11-23 07:42:57:234]  Error: Authentication error: Error authenticating with Jira: Error: socket hang up

Running the curl command in terminal is successful.

curl -X GET -H "X-Atlassian-Token:no-check" -H "x-atlassian-force-account-id:true" -H "Content-Type:application/json" -H "Authorization:Basic **************" "https://jira.x.y.com/rest/api/2/myself"

{"self":"https://jira.x.y.com/rest/api/2/user?username=myusername","key":"myusername","name":"myusername","emailAddress":"mmyusername@mycompany.com","avatarUrls":{"48x48":"https://jira.x.y.com/secure/useravatar?ownerId=myusername&avatarId=15508","24x24":"https://jira.x.y.com/secure/useravatar?size=small&ownerId=myusername&avatarId=15508","16x16":"https://jira.x.y.com/secure/useravatar?size=xsmall&ownerId=myusername&avatarId=15508","32x32":"https://jira.x.y.com/secure/useravatar?size=medium&ownerId=myusername&avatarId=15508"},"displayName":"My Username","active":true,"timeZone":"Europe/London","locale":"en_UK","groups":{"size":8,"items":[]},"applicationRoles":{"size":1,"items":[]},"expand":"groups,applicationRoles"}%

I have validated my proxy settings are the same in Network Preferences and in the shell, my Jira domain name is included as a wildcard *.x.y.com in the bypass list and no_proxy envvar respectively. The VS Code setting http.proxy is not configured.

I have tried with the atlascode:enableHttpsTunnel enabled & disabled.

I have tried with proxy server details removed from both Network Preferences and in the shell.

Comments (5)

  1. Jonathan Doklovic Account Deactivated

    Hi @Martin van der Boon

    The option to enable the https tunnel only shows up when the extension finds proxy settings (http(s).proxy set, so somehow it’s finding that setting. Maybe VS Code is pulling it form env vars?

    Here is the code that handles no_proxy… can you tell me if your no_proxy setting matches these rules? Looks like you may just need .myjira.com in the bypass/no_proxy list instead of using the wildcard

    export function shouldTunnelHost(hostname: string): boolean {
        /*
        we follow these rules:
            - NO_PROXY is a comma-separated list of hostnames and domains.
            - A hostname (e.g., mail, company.com, www.company.com) matches only that one hostname.
            - A domain starts with a . (e.g., .company.com) and matches all hostnames in that domain, including the hostname equal to the domain (e.g., .company.com matches company.com, www.company.com, mail.company.com).
        */
        const ignores = getProxyIgnores(); // essentially NO_PROXY.split(',');
        for (let ignore of ignores) {
            if (ignore.startsWith('.')) {
                const domain = ignore.substr(1);
                if (hostname.includes(domain)) {
                    return false;
                }
            } else {
                if (hostname.split(':')[0] === ignore) {
                    return false;
                }
    
    
            }
        }
    
        return true;
    }
    

    Also, can you open up your VS Code settings and search for “Charles” and make sure enable Charles for Atlassian settings in NOT checked?

  2. Log in to comment