SYMPTOM

When executing a mapping which reads or writes to a google spreadsheet ; or when querying a google spreadsheet with Stambia's Google Driver, an error like the one below sometimes occurs.

com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetException: com.google.gdata.util.ServiceException: Bad Gateway
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 502 (Server Error)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>502.</b> <ins>That’s an error.</ins>
  <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins>
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetConnection$WorksheetIterator.<init>(SpreadsheetConnection.java:753)
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetConnection$WorksheetIterator.<init>(SpreadsheetConnection.java:744)
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetConnection.getWorksheet(SpreadsheetConnection.java:877)
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetSatement.executeTruncate(SpreadsheetSatement.java:233)
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetSatement.execute(SpreadsheetSatement.java:91)
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetSatement.executeUpdate(SpreadsheetSatement.java:451)
    at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
    at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
    at com.indy.engine.actionCodes.JdbcActionCodeI.executeDDL_DML(SourceFile:917)
    at com.indy.engine.actionCodes.JdbcActionCodeI.executeSimpleCode(SourceFile:1414)
    at com.indy.engine.action.common.ActionCodeTypeI.executeCode(SourceFile:1646)
    at com.indy.engine.action.common.ActionCodeTypeI.run(SourceFile:1805)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.gdata.util.ServiceException: Bad Gateway
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 502 (Server Error)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>502.</b> <ins>That’s an error.</ins>
  <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins>
    at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:632)
    at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
    at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
    at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
    at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
    at com.google.gdata.client.Service.getFeed(Service.java:1135)
    at com.google.gdata.client.Service.getFeed(Service.java:998)
    at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
    at com.google.gdata.client.Service.getFeed(Service.java:1017)
    at com.google.gdata.data.spreadsheet.SpreadsheetEntry.getWorksheets(SpreadsheetEntry.java:128)
    at com.stambia.jdbc.driver.google.spreadsheet.SpreadsheetConnection$WorksheetIterator.<init>(SpreadsheetConnection.java:748)
    ... 12 more

 

SOLUTION

This "Bad Gateway" error is raised by Google's servers. Stambia cannot do anything about this.

The only thing to do is to retry executing the query, after 30 seconds as stated by Google's error message.