sdefresne / gerrit-monitor

Source for Gerrit Monitor Chrome extension
Apache License 2.0
21 stars 16 forks source link

Can't loading from certain remotes, possibly those containing multiple "-" #16

Closed loadedsith closed 4 years ago

loadedsith commented 5 years ago

Hello,

I use your monitor on 3 different hosts. 1 of those hosts works consistently, and 2 of them fail to work consistently. The names might be sensitive, but the ones that work are in the format aaaaaaaa-review and the ones that dont are in the format aaaaaa-aaaaa-review.

Could there be an issue with hosts with names with multiple '-'?

If that's not making sense, how can I help debug this issue?

Thanks

sdefresne commented 5 years ago

Hello,

In my experience, the most common reason why some hosts are not working is that the JSON API is disabled for the particular gerrit installation or it is using a version of the API that is incompatible with the extension.

One way to debug is to inspect the network traffic generated by the extension when it communicates with the gerrit instance. You can do this by going to chrome://extensions, clicking on "Details" for "Gerrit Monitor", then click on the link "background.html" in "Inspect views".

This should open a new window with developer tools. Then you can inspect in the network tab the requests and the responses from the servers. Requests are sent periodically (every 5 minutes) or when you click on the badge in the Chrome UI. In the network tab, for each instance, you should see a request for /accounts/self followed by a request for /changes/?q=status:open+...

The reply in each case should be a JSON file (first request will contain information about the logged in user, second one will contain the list of changelist are currently opened and may require your attention).

If the content of those requests is as expected, then the issues lies in the extension. If it is not, there may exists an issue with the gerrit configuration. In the first case, we can try to debug together to see what is causing the extension to fail.

Cheers,

loadedsith commented 5 years ago

I'm able to observe this error;

Access to XMLHttpRequest at '[redacted]' (redirected from '[redacted]') from origin 'chrome-extension://leakcdjcdifiihdgalplgkghidmfafoh' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

I've emailed you a couple of unredacted screenshots.

Hope that helps, Graham

loadedsith commented 4 years ago

I decided to reinvestigate this, and discovered that it's caused by a HTTPS upgrade redirect.

http://foo-review.googlesource.com/ (bad)

vs

https://foo-review.googlesource.com/ (good)

Derp.

I'll close this now. Hopefully this thread helps someone else.