Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting to github enterprise #30

Open
lhayhurst opened this issue Feb 1, 2021 · 7 comments
Open

Error connecting to github enterprise #30

lhayhurst opened this issue Feb 1, 2021 · 7 comments

Comments

@lhayhurst
Copy link

lhayhurst commented Feb 1, 2021

Hi, I'm connecting to github enterprise instance and am getting a "!" as the label on status bar. It appears to be hitting this line of code.

I'm getting this in my logs:

image

(empty response error, with error code ... 2?!).

I've verified that:

  • my Github handle is correct
  • the Github token is valid, and has the correct Notification scope
  • the Github Hostname is correct, does not include "http[s]://", and has no path parameters.

I'm on Ubuntu 20.04.

Cheers!

@alexduf
Copy link
Owner

alexduf commented Feb 2, 2021

Hey @lhayhurst thanks for the bug report!

I'm not sure I'll have the time to debug that one, nor the test environment I'm afraid!

I wonder what's happening there, it the URL is correct, the traces sure are confusing 🤔

@lhayhurst
Copy link
Author

No worries, thanks for the reply. I can try to isolate the issue "by hand" -- any pro tips on how to debug it? (For ex, can I pull the javascript code out, run it by hand, and try to isolate the issue -- my hunch is that this is a Github enterprise thing).

@alexduf
Copy link
Owner

alexduf commented Feb 2, 2021

Now that's a very good question! Developing gnome extensions is, hmm, fiddly at best. You can pull the repo locally like this and modify the code to print more information.

The logs are visible using looking glass alt + f2, then lg. Under Xorg you can quickly restart the whole desktop to reload the extension by doing alt + f2, then r, but unfortunately this doesn't work with wayland. Maybe a "log-out"/"log-in" does the job though.

It might be something silly, it might be worth trying to print the request before it goes to the server, and trying to replay it with curl to see what happens?

That's pretty much all I have! do ask if you have any more question, I'll try my best to answer what I can.

@lhayhurst
Copy link
Author

lhayhurst commented Feb 2, 2021

Hi, I gave this a shot -- whenever I print the authUri, it prints out that it is a SoupURI instance, but doesn't actually print the url its trying to hit. I tried putting this in the fetchNotifications method:

error("github auth uri: " + this.authUri.soup_uri_to_string())

after looking at the docs, but got the error message "this.authUri.soup_uri_to_string is not a function". Do you know off hand how to stringify the uri? I'll keep digging as well.

@alexduf
Copy link
Owner

alexduf commented Feb 3, 2021

Not off the top of my head, but I wonder if using this notation might work?

Soup.URI.prototype.soup_uri_to_string.call(this.authUri);

Like here

@lhayhurst
Copy link
Author

Hi, I was able to solve this just by staring at code and reading docs.

With github enterprise, the urls are different. This is what it should look like for github enterprise (extension.js, line 63):

    let url = 'https://' + this.domain + "/api/v3/notifications"
    if (this.showParticipatingOnly) {
      url += "?participating=1"
    }

From this Stack Overflow:

image

It is now working fine for me. I just hacked the thing locally, so, not great. In terms of applying this change to your master, I can think of several ways:

  1. If the Github Hostname is not set to "github.com", then assume using github enterprise (probably bad)
  2. Add a checkbox in in prefs.js that lets the user specify that they are using GE. If set to true, the url construction would follow the sketched code above. I tried poking around the prefs.js to add a GtkCheckbox, but failed miserably :/

@alexduf
Copy link
Owner

alexduf commented Feb 3, 2021

ha, amazing!

I'll look into fixing it this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants