QueryResponse - getReasons() : it does not return expected value

129 views
Skip to first unread message

Jean-Rémi Delteil

unread,
Feb 16, 2015, 10:09:35 AM2/16/15
to google-visua...@googlegroups.com
Hello,

The following spreadsheet is not public, so the query.send() request will throw an error 403 in the browser console.
But this error is not reported in the callback response parameter.

With a small script (at the end of this post), I get the following console log :

15:40:11.321   https://docs.google.com/a/revevol.eu/spreadsheets/d/1ddmng6RKNaHcxX_s5jLXEKhd3lOXRuXmOPbXsWZRpE8/gviz/tq?headers=2&range=A1:H&sheet=Sheet1&tqx=reqId:0  Failed to load resource: the server responded with a status of 403 (OK)
15:40:41.000   test.html:21  Query DATA fetch: 30006.907ms
15:40:41.000   test.html:23  isError : true
15:40:41.007   test.html:24  hasWarning : false
15:40:41.008   test.html:25  getReasons : timeout
15:40:41.008   test.html:26  getMessage : Request timed out
15:40:41.008   test.html:27  getDetailedMessage :

The documentation says that getReasons() can return the followings code :
  • access_denied The user does not have permissions to access the data source.
  • invalid_query The specified query has a syntax error.
  • data_truncated One or more data rows that match the query selection were not returned due to output size limits. (warning).
  • timeout The query did not respond within the expected time.

Here, in this case, we should get an access_denied message.
It's either a problem in the google spreadsheet visualization implementation, either the mechanism behind query.send() in visualization.

As you can see in the time-stamps, the error 403 got thrown just after the query, but query.send() wait until the timeout (30 sec by default) to kick back.
This problem now impacts Awesome Table, where it is necessary to get the correct reason of failure to inform the users.

Thank you for your time,

Jean-Rémi Delteil, Awesome Table Team


ps : here is the script :

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization', 'version':'1','packages':['controls']}]}"></script>
</head>
<body>
<script>
google.setOnLoadCallback(sendQuery);
function sendQuery(){
var query = new google.visualization.Query(queryString);
// send the query
console.time('Query DATA fetch');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
console.timeEnd('Query DATA fetch');

console.log('isError : ' + response.isError());
console.log('hasWarning : ' + response.hasWarning());
console.log('getReasons : ' + response.getReasons());
console.log('getMessage : ' + response.getMessage());
console.log('getDetailedMessage : ' + response.getDetailedMessage());
}
</script>
</body>
</html>


Daniel LaLiberte

unread,
Feb 17, 2015, 10:15:10 AM2/17/15
to google-visua...@googlegroups.com
Hi Jean-Rémi

It appears the api must have handled this access_denied error at some time in the past, but at this time, it is not, perhaps due to changes on the spreadsheet side.  We will investigate whether we can fix this.  Thanks for your  report.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

tim paul

unread,
Sep 1, 2015, 2:23:09 AM9/1/15
to Google Visualization API
Hi there Daniel!

We're slamming up against this issue right now too. Just wondering if there is any chance of a possible fix somewhere in the pipeline in the near future (or even at all)? 

It would be so awesome to be able to immediately catch the 403 - rather than having to wait for the Query timeout...

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA

Dutch

unread,
Sep 14, 2015, 5:38:04 PM9/14/15
to Google Visualization API
Same issue here - I am unable to catch this error immediately - have to wait for timeout. This used to work just fine.
Reply all
Reply to author
Forward
0 new messages