New issue
Advanced search Search tips

Issue 821506 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocked on:
issue 826834

Blocking:
issue 772391



Sign in to add a comment

Tricium JS errors in gerrit-review

Project Member Reported by beckysiegel@google.com, Mar 13 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36

Steps to reproduce the problem:
Go to a change on gerrit-review.googlesource.com (I was logged in on a change I own with this trace)

https://gerrit-review.googlesource.com/c/gerrit/+/165452

What is the expected behavior?

What went wrong?
Failed to load resource: the server responded with a status of 404 ()
tricium-dev.appspot.com/prpc/tricium.Tricium/Progress Failed to load resource: the server responded with a status of 404 ()
gr-app.js:1421 [dom-repeat::dom-repeat]: expected array for `items`, found Object
_logger @ gr-app.js:1421
tricium-view.js:117 TypeError: results.every is not a function
    at HTMLElement._isDone (tricium-view.js:157)
    at HTMLElement._update (tricium-view.js:138)
    at $.client.getProgress.then (tricium-view.js:113)
    at <anonymous>
$.client.getProgress.then.catch @ tricium-view.js:117
/accounts/self/oauthconfig Failed to load resource: the server responded with a status of 404 ()
tricium-dev.appspot.com/prpc/tricium.Tricium/Progress Failed to load resource: the server responded with a status of 404 ()
gr-app.js:1421 [dom-repeat::dom-repeat]: expected array for `items`, found Object
_logger @ gr-app.js:1421
tricium-view.js:117 TypeError: results.every is not a function
    at HTMLElement._isDone (tricium-view.js:157)
    at HTMLElement._update (tricium-view.js:138)
    at $.client.getProgress.then (tricium-view.js:113)
    at <anonymous>
$.client.getProgress.then.catch @ tricium-view.js:117
gr-app.js:1917 GET https://gerrit-review.googlesource.com/accounts/self/oauthconfig 404 ()
_fetchWithXsrfToken @ gr-app.js:1917
fetch @ gr-app.js:1916
send @ gr-app.js:1987
GrPluginRestApi.fetch @ gr-app.js:2649
GrPluginRestApi.send @ gr-app.js:2649
GrPluginRestApi.get @ gr-app.js:2650
_getOAuthConfig @ tricium-client.js:290
Promise.then @ tricium-client.js:261
Promise.then (async)
plugin.restApi.getLoggedIn.then @ tricium-client.js:260
Promise.then (async)
_configureOAuthLibrary @ tricium-client.js:245
getOAuthToken @ tricium-client.js:50
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
Progress:1 POST https://tricium-dev.appspot.com/prpc/tricium.Tricium/Progress 404 ()
gr-app.js:1421 [dom-repeat::dom-repeat]: expected array for `items`, found {}
_logger @ gr-app.js:1421
_error @ gr-app.js:1421
_itemsChanged @ gr-app.js:1781
_complexObserverEffect @ gr-app.js:1617
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
__setProperty @ gr-app.js:1608
__setPropertyImpl @ gr-app.js:1759
_applyEffectValue @ gr-app.js:1630
_annotationEffect @ gr-app.js:1615
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
__setProperty @ gr-app.js:1608
__setPropertyImpl @ gr-app.js:1759
_forwardParentProp @ gr-app.js:1804
(anonymous) @ gr-app.js:1763
_functionEffect @ gr-app.js:1616
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
__setProperty @ gr-app.js:1608
_applyEffectValue @ gr-app.js:1630
_annotationEffect @ gr-app.js:1615
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
setter @ gr-app.js:1611
_update @ tricium-view.js:137
$.client.getProgress.then @ tricium-view.js:113
Promise.then (async)
$.client.getOAuthToken.then @ tricium-view.js:112
Promise.then (async)
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
tricium-view.js:117 TypeError: results.every is not a function
    at HTMLElement._isDone (tricium-view.js:157)
    at HTMLElement._update (tricium-view.js:138)
    at $.client.getProgress.then (tricium-view.js:113)
    at <anonymous>
$.client.getProgress.then.catch @ tricium-view.js:117
Promise.catch (async)
$.client.getOAuthToken.then @ tricium-view.js:114
Promise.then (async)
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
gr-app.js:1917 GET https://gerrit-review.googlesource.com/accounts/self/oauthconfig 404 ()
_fetchWithXsrfToken @ gr-app.js:1917
fetch @ gr-app.js:1916
send @ gr-app.js:1987
GrPluginRestApi.fetch @ gr-app.js:2649
GrPluginRestApi.send @ gr-app.js:2649
GrPluginRestApi.get @ gr-app.js:2650
_getOAuthConfig @ tricium-client.js:290
Promise.then @ tricium-client.js:261
Promise.then (async)
plugin.restApi.getLoggedIn.then @ tricium-client.js:260
Promise.then (async)
_configureOAuthLibrary @ tricium-client.js:245
getOAuthToken @ tricium-client.js:50
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
setTimeout (async)
$.client.getProgress.then.catch.then @ tricium-view.js:121
Promise.then (async)
$.client.getOAuthToken.then @ tricium-view.js:118
Promise.then (async)
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
Progress:1 POST https://tricium-dev.appspot.com/prpc/tricium.Tricium/Progress 404 ()
gr-app.js:1421 [dom-repeat::dom-repeat]: expected array for `items`, found {}
_logger @ gr-app.js:1421
_error @ gr-app.js:1421
_itemsChanged @ gr-app.js:1781
_complexObserverEffect @ gr-app.js:1617
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
__setProperty @ gr-app.js:1608
__setPropertyImpl @ gr-app.js:1759
_applyEffectValue @ gr-app.js:1630
_annotationEffect @ gr-app.js:1615
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
__setProperty @ gr-app.js:1608
__setPropertyImpl @ gr-app.js:1759
_forwardParentProp @ gr-app.js:1804
(anonymous) @ gr-app.js:1763
_functionEffect @ gr-app.js:1616
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
__setProperty @ gr-app.js:1608
_applyEffectValue @ gr-app.js:1630
_annotationEffect @ gr-app.js:1615
_effectEffects @ gr-app.js:1609
_propertySetter @ gr-app.js:1608
setter @ gr-app.js:1611
_update @ tricium-view.js:137
$.client.getProgress.then @ tricium-view.js:113
Promise.then (async)
$.client.getOAuthToken.then @ tricium-view.js:112
Promise.then (async)
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
setTimeout (async)
$.client.getProgress.then.catch.then @ tricium-view.js:121
Promise.then (async)
$.client.getOAuthToken.then @ tricium-view.js:118
Promise.then (async)
_refreshProgress @ tricium-view.js:110
_updateTimerFired @ tricium-view.js:176
tricium-view.js:117 TypeError: results.every is not a function
    at HTMLElement._isDone (tricium-view.js:157)
    at HTMLElement._update (tricium-view.js:138)
    at $.client.getProgress.then (tricium-view.js:113)
    at <anonymous>

Did this work before? N/A 

Chrome version: 64.0.3282.186  Channel: n/a
OS Version: OS X 10.13.3
Flash Version:
 

Comment 1 by wyatta@google.com, Mar 13 2018

Cc: aga...@chromium.org

Comment 2 by wyatta@google.com, Mar 13 2018

Components: -Blink Infra>Codereview>Gerrit
Labels: Needs-Triage-M64
Labels: Triaged-ET TE-NeedsTriageHelp
The issue seems to be out of TE-scope as it is related to Infra>Codereview>Gerrit. Hence, adding label TE-NeedsTriageHelp for further investigation from dev team.

Thanks...!!

Comment 5 by aga...@chromium.org, Mar 14 2018

Labels: -TE-NeedsTriageHelp -Via-Wizard-Javascript -Triaged-ET -Needs-Triage-M64
Owner: qyears...@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for taking a look, we've got this one.

Assigning to Quinten, the owner of the tricium plugin.
Status: Started (was: Assigned)
Thanks for filing and triaging!

First and most obvious thing is the error with `results.every` being called when `results` is an Object rather than an Array. This could have been introduced several weeks ago in https://chromium-review.googlesource.com/c/909994/ and I didn't notice til enabling the plugin with Gerrit.

Not sure yet if 
gr-app.js:1421 [dom-repeat::dom-repeat]: expected array for `items`, found Object
is a separate issue.
Blocking: 772391
Project Member

Comment 8 by bugdroid1@chromium.org, Mar 15 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/gerrit-plugins/tricium/+/ad3a3ed9783f2819d2f1bf3a3c3df17bd086d3bf

commit ad3a3ed9783f2819d2f1bf3a3c3df17bd086d3bf
Author: Quinten Yearsley <qyearsley@chromium.org>
Date: Thu Mar 15 15:48:22 2018

Fix empty results from getProgress so it is Array

When changing the behavior for tricium-client getProgress
so that it returns an empty result in the case of 404,
I got the type of result wrong; it should be an Array.

This fixes that and also updates a couple of comments.

Bug:  821506 
Change-Id: I089801fcfdd6808146ebad5310ebcc3242cb6793
Reviewed-on: https://chromium-review.googlesource.com/963485
Reviewed-by: Edwin Kempin <ekempin@google.com>

[modify] https://crrev.com/ad3a3ed9783f2819d2f1bf3a3c3df17bd086d3bf/test/tricium-client_test.html
[modify] https://crrev.com/ad3a3ed9783f2819d2f1bf3a3c3df17bd086d3bf/src/main/resources/static/tricium-client.js
[modify] https://crrev.com/ad3a3ed9783f2819d2f1bf3a3c3df17bd086d3bf/src/main/resources/static/tricium-view.js

The errors mentioned in #6 (error when calling results.every with {}, and dom-repeat error) are now resolved with the latest deployed version.

There is still a problem with the Tricium plugin in gerrit-review though:

  gr-app.js:1918 GET https://gerrit-review.googlesource.com/accounts/self/oauthconfig 404 ()
  _fetchWithXsrfToken @ gr-app.js:1918
  fetch @ gr-app.js:1917
  ...
  _getOAuthConfig @ tricium-client.js:292
  ...
  getOAuthToken @ tricium-client.js:50
  _refreshProgress @ tricium-view.js:110
  _updateTimerFired @ tricium-view.js:179

It seems like _updateTimerFired is repeatedly firing, causing getOAuthToken to be called, which calls _getOAuthConfig, which fails, but getOAuthToken returns a resolved progress anyway, and then getProgress is called, which does work.

A couple things should change here.

 1. Apparently setting up _getOAuthConfig isn't necessarily currently for getting Tricium Progress;
    If _getOAuthConfig isn't necessary, we shouldn't need to call it.
 2. Also, _updateTimerFired doesn't need to keep firing once all analyzers are finished.

https://chromium.googlesource.com/infra/gerrit-plugins/tricium/+/master/src/main/resources/static/tricium-client.js
Blockedon: 826834
Update: now the googleoauth plugin has been activated, but now the Tricium plugin isn't showing up at all on the gerrit host.

After digging in a bit, I noticed that _refreshToken in the client element is never resolving, because gapi.auth.authorize is not returning any kind of token. When I searched for documentation about this, I found that gapi.auth isn't really supported.

Filed  bug 826834 .
Status: Fixed (was: Started)
Logged errors resolved now.

Sign in to add a comment