ljay79 / jira-tools

Project Aid for Jira - Google Spreadsheet Add-on for Jira Integration
GNU General Public License v3.0
112 stars 46 forks source link

Can't connect to self-hosted Jira - Error 500 #89

Closed narvek closed 5 years ago

narvek commented 6 years ago

We have a self hosted Jira. I've used our https address to try to connect, using the user/pw that I use to connect to Jira, but am receiving an error 500. I've turned on debugging, Temp. User Key: AG3SVdnnYwlEEf4WhKu29b2uQYtqi6g5yLPvqVoETwdUBtEQuXPV4iCepMnr5ymV8ErcULHRYW1j

ljay79 commented 6 years ago

Hi @narvek

Are you trying to connect to your Jira instance with URL https://jira.sccoe.org/ ? This appears to be a not publicly routed domain. I am getting DNS errors when trying to open it in a browser.

Google add-ons (like this here) will only work with public hosted and reachable services.

narvek commented 6 years ago

Oh my. Yes you are right. Will have to see if I can white list. Thanks. And apologies for such a rookie mistake.

On Jun 24, 2018, 6:57 AM -0700, Jens notifications@github.com, wrote:

Hi @narvekhttps://github.com/narvek

Are you trying to connect to your Jira instance with URL https://jira.sccoe.org/ ? This appears to be a not publicly routed domain. I am getting DNS errors when trying to open it in a browser.

Google add-ons (like this here) will only work with public hosted and reachable services.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ljay79/jira-tools/issues/89#issuecomment-399758579, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Amn8Of_EflkMzRSa0pJ6DhiPIT0rL-xpks5t_5rDgaJpZM4U0MZi.

phyllisz commented 6 years ago

Hi, I have this same error. My colleague was able to get it setup but I'm getting this error 500.

temp user key: AG3SVdlne3SKQiqDRg/LBAlKA4bhCWoxgRQZMwWXNN7fRiy2FzDaoY7eQSSPvXlotQlKcegUKT8b

ljay79 commented 6 years ago

Hi @phyllisz

I personally never saw a Jira cloud domain like "https://xxxx.jira.com". What version of Jira are you guys running under that domain?

Your colleague is using the same Jira instance? May you ask him how he did connect successfully - using what settings and maybe even share the feedback here with me and other potential users with same issue.

phyllisz commented 6 years ago

hmmm not sure, I can't find a version number for our JIRA cloud, I would assume it's just whatever latest is available since it's constantly updated from Atlassian.

Yup, we are using the same. I went over the setup with him and we put in the same values (aside from email/pswd).

Am I putting in the pswd wrong? I write it [email]+[password] - and various combinations. I also tried the API token.

ljay79 commented 6 years ago

You usually need the email + password or username + password. Or when using API Token, you would use your Atlassian username + API token.

It sounds strange... when your colleage is able to use same jira instance to connect with you should not have any issues either. Unless your Jira account has some restrictions in the permissions, which i dont assume atm as the plain connection test does not require any special permissions.

Sry that i am not that helpful. Its just quite impossible for me to look into your user account jira issue as an outsider. The only known issues i am aware of are possible interferences when using Google Login with Jira (https://github.com/ljay79/jira-tools/tree/master#known-issues) or when the Jira instance itself is within a local network. Both appear not to apply to you.

On top of this. When the credentials are wrong, Jira would quit the connection usually with an error code 401 (for unauthorized). While you expiriencing an error 500 (internal server error).

Are you or your colleage able to test the jira api connection with curl if i instruct you on the api call?

ljay79 commented 6 years ago

To test the authentification with your Jira instance via curl, you can check the output of this:

curl -D- -u <email>:<password> -X GET -H "Content-Type: application/json" "https://<xxxx>.jira.com/rest/api/2/dashboard"

Another thing: To check if this issue is caused by your user account, have your colleage come over and test the connection with his login details. Afterwards you can remove the details again.

ljay79 commented 6 years ago

@phyllisz did you had any luck yet? And further insight? Other wise i would close this issue.

phyllisz commented 6 years ago

Hi, Nope didn't make any progress. I'll give it another try this week.

tcorman commented 6 years ago

We're having the same 500 error with JIRA in the cloud. What's really odd is that it's specific to one user - the rest of us are configured identically and have no problem using Sheets Tools. One use, who is having no problems accessing JIRA in the browser, gets the 500 error when she attempts to configure Sheet Tools settings. Should the diagnostic curl command about work against a cloud JIRA instance?

ljay79 commented 6 years ago

Hi @tcorman

The above curl command would give a good indication of wether authentication for her works through api, yes. curl -D- -u <email>:<password> -X GET -H "Content-Type: application/json" "https://<xxxx>.jira.com/rest/api/2/dashboard"

For further insight from my end, (on the affected users google sheet) please activate Debugging in "About" dialog, provide the your "Temp. User Key" and then perform at least one another try. This way it will log possible errors and information to my StackDriver logging account where i can analyze it better. User credentials are not transmitted in any log data.

tcorman commented 5 years ago

OK, issue persists, curl command works fine for both me and the user who is experiencing the 500 error. She has enabled debugging, I can send you her temp key if that helps.

ljay79 commented 5 years ago

From my end i am unable to get more insights into that as the error code itself. For security reason of the authentication.

So i can actually only much advise with Tips to Try&Error all possible circumstances until solved.

See above comment for details: https://github.com/ljay79/jira-tools/issues/89#issuecomment-401532098

Just to make sure:

tcorman commented 5 years ago

I'm confused, though - if username/password was the issue, wouldn't the curl command fail?

ljay79 commented 5 years ago

@tcorman yeah you're right lol. Confusing my self... as you figured, i dont have any further clue what the issue could be.

In case you are firm, you can try same curl command with username/password encrypted base64 for basic auth. As this is the way, the add-on will request the api.

ljay79 commented 5 years ago

@tcorman you tried uninstalling / reinstalling the add-on already?

And to be sure, the 500 error appears during editing the settings in my add-on, not somewhere else?

ljay79 commented 5 years ago

Just in case you guys didnt tried yet... for curiosity...

The troubling user, should create a own personal completely new spreadsheet. No sharing. Then reinstall the add-on, and try to setup connection etc...

I can only guess there is some strange auth behavior when accessing a shared sheet with the add-on installed. Otherwise i really dont have a clue anymore what the cause could be.

The add-on performs basic simple HTTP(S) requests to the Jira instance using google UrlFetchApp.fetch

ljay79 commented 5 years ago

Everyone still having the error 500 issue, please provide me with the Temp User key from the add-on's "About" dialog and perform at least 1 try of saving the connection settings for Jira. Thx

tcorman commented 5 years ago

Is it ok to post Temp Key here in the clear?

Yes, uninstalled/reinstalled, no change. I and one other user are having no problems - it's specific to this one user, but her JIRA privileges are the same as ours.

ljay79 commented 5 years ago

Yes it should be fine to post this key here. Only use I know of, is for identification in my stack driver logs.

Info about the user key in question: https://developers.google.com/apps-script/reference/base/session#getTemporaryActiveUserKey()

Gets a temporary key that is unique to the active user but does not reveal the user identity. The temporary key rotates every 30 days and is unique to the script.

tcorman commented 5 years ago

Temp key for user w issues: AEt9bgQ1QVmAmKy6HmmHbm+Kqp9K9GSCE+qWbqrcrVd1wYcSJKq/TnGxlr8YoOle00Xu1ytVJfZB

tcorman commented 5 years ago

@ljay79 Following up - any insights based on above user's key?

ljay79 commented 5 years ago

Sry @tcorman, i was on annual vacation in december and then the seasons holidays. Im now "back in business".

Could you please redo the debugging steps with the affected user:

Thx and appologies for late reply and delay.

tcorman commented 5 years ago

@ljay79 Thanks - will do Wed afternoon, and will post here.

tcorman commented 5 years ago

@ljay79 Just enabled debugging. Her temp user key: AFzpkEQix9mAzB+UdvMBBWUC8lrImRdd7Oxcn0yqr3VIYcsnhho4vR5Uf9JRCt9v5uzKGOl/6zaX Tried request at ~1:12 PM Pacific with user ctrese using a Sheet that I own: List issues from filter displays dialog, then returns "Exception: SSL Error https://vlocity.attlassian.net/rest/api/2/filter/favourite?includeFavourites=true" Works fine for me.

Next experiment: user ctrese creates a Sheet and chooses "List Issues from filter." Dialog displays but hangs populating a list of the filters she owns.

That's all we tried - let me know how we can provide more debug details. Thanks for your help!

ljay79 commented 5 years ago

Thank you, the error lies in the posted error message and the logs do confirm this.

In best case; it was really just this simply typo: The URL for (her) Jira instances used is incorrect. "Atlassian" is written with a single "t" and not like she/you wrote and used it with double "t".

I hope it was just as simple issue as this :)

tcorman commented 5 years ago

@ljay79 Oy vey, really? Will check. It sure makes sense. I'll let you know.

ljay79 commented 5 years ago

@tcorman any news? Issue solved?

ljay79 commented 5 years ago

Assumes fixed. Closed due to inactivity.

tcorman commented 5 years ago

@tcorman any news? Issue solved?

@ljay79 Here's what we learned: You correctly told us that the JIRA RL was misspelled, which solved the 500 error. She then got 401, unauthorized, because she had not correctly specified her credentials. We suggest modifying the setup instructions to clarify what to do, as follows:

  1. In the JIRA URL field, type https://vlocity.atlassian.net.
  2. In the Username/Email field, type @vlocity.com
  3. In the Password or API Token field, enter an API Token. See https://confluence.atlassian.com/cloud/api-tokens-938839638.html
  4. Click Save.