Search code examples
google-mapsesbgoogle-geocoding-api

Google Geocoding API returning 500 Internal Server Error


Let me preface this with: I am not a developer. I'm currently using Mulesoft to integrate several systems (application originally developed by an outsourced developer). Part of the application is to merge records that might be common across the systems. To do that, I'm using the record name and geocode for the associated address. Until the past week this was working fine. Now I'm receiving an error when this part of the application runs. The debug logs from the particular call that failed is:

[2016-10-11 16:02:06.163] DEBUG  com.ning.http.client.providers.grizzly.AsyncHttpClientFilter [[tbosa-rpm].DefaultSftpConnector.receiver.01]: (t:null) REQUEST: HttpRequestPacket ( method=GET
url=/maps/api/geocode/json
query=key=[REMOVED]&address=%[REMOVED]%20[REMOVED]%20[REMOVED]%2CSPRING%20BRANCH%2CTX%22
protocol=HTTP/1.1
content-length=-1
headers=[
MULE_CORRELATION_SEQUENCE=969
MULE_CORRELATION_ID=bd4249f0-8fcb-11e6-9620-12fd3e455356
MULE_CORRELATION_GROUP_SIZE=4375
Host=maps.googleapis.com:443
User-Agent=AHC/1.0
Connection=keep-alive
Accept=*/*]
)
[2016-10-11 16:02:06.164] DEBUG org.mule.module.http.internal.HttpMessageLogger [[tbosa-rpm].DefaultSftpConnector.receiver.01]: (t:null) REQUESTER
GET /maps/api/geocode/json?key=[REMOVED]&address=%[REMOVED]%20[REMOVED]%20[REMOVED]%2CSPRING%20BRANCH%2CTX%22 HTTP/1.1

MULE_CORRELATION_SEQUENCE: 969

MULE_CORRELATION_ID: bd4249f0-8fcb-11e6-9620-12fd3e455356

MULE_CORRELATION_GROUP_SIZE: 4375

Host: maps.googleapis.com:443

User-Agent: AHC/1.0

Connection: keep-alive

Accept: */*

Content-Type: application/json; charset=UTF-8


[2016-10-11 16:02:07.684] DEBUG org.mule.module.http.internal.HttpMessageLogger [[tbosa-rpm].http.requester.GeocoderRequest.worker(1)]: (t:null) REQUESTER
HTTP/1.1 500 Internal Server Error

Content-Type: application/json; charset=UTF-8

Date: Tue, 11 Oct 2016 16:02:07 GMT

Pragma: no-cache

Expires: Fri, 01 Jan 1990 00:00:00 GMT

Cache-Control: no-cache, must-revalidate

Access-Control-Allow-Origin: *

Server: mafe

X-XSS-Protection: 1; mode=block

X-Frame-Options: SAMEORIGIN

Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"

Accept-Ranges: none

Vary: Accept-Language,Accept-Encoding

Transfer-Encoding: chunked

35

{
"results" : [],
"status" : "UNKNOWN_ERROR"
}


0

[2016-10-11 16:02:07.684] DEBUG com.ning.http.client.providers.grizzly.AhcEventFilter [[tbosa-rpm].http.requester.GeocoderRequest.worker(1)]: (t:null) RESPONSE: HttpResponsePacket (
status=500
reason=Internal Server Error
protocol=HTTP/1.1
content-length=-1
committed=false
headers=[
content-type=application/json; charset=UTF-8
date=Tue, 11 Oct 2016 16:02:07 GMT
pragma=no-cache
expires=Fri, 01 Jan 1990 00:00:00 GMT
cache-control=no-cache, must-revalidate
access-control-allow-origin=*
server=mafe
x-xss-protection=1; mode=block
x-frame-options=SAMEORIGIN
alt-svc=quic=":443"; ma=2592000; v="36,35,34,33,32"
accept-ranges=none
vary=Accept-Language,Accept-Encoding
transfer-encoding=chunked]
)

The problem doesn't seem to be with the geocoding API itself, as I can make a manual call for the same address without any issues. The connection is throttled, so we shouldn't be hitting up against any limits on requests per second. This is the piece of code from the application that governs the API call:

<flow name="rpm-geocode-lookup" processingStrategy="synchronous">
    <set-payload value="#[payload.addressLine1],#[payload.city],#[payload.state]" doc:name="Set Location"/>
    <ee:cache cachingStrategy-ref="GeocoderCachingStrategy" doc:name="Geocoder Cache">
        <json:object-to-json-transformer doc:name="Object to JSON"/>
        <logger level="DEBUG" category="com.tbosa.esb.rpm" message="Making call to Geocoder for #[payload]" doc:name="Not Cached"/>
        <http:request config-ref="GeocoderRequest" path="/geocode/json" method="GET" doc:name="Geocoder Request">
            <http:request-builder>
                <http:query-param paramName="key" value="${geocoder.key}"/>
                <http:query-param paramName="address" value="#[payload]"/>
            </http:request-builder>
        </http:request>
        <json:json-to-object-transformer returnClass="java.util.Map" doc:name="JSON to Object"/>
        <choice doc:name="Choice">
            <when expression="#[payload.status == 'OK' || payload.results.size() &gt; 0]">
                <set-payload value="#[new java.lang.String(payload.results[0].geometry.location.lat) + payload.results[0].geometry.location.lng]" doc:name="Latitude+Longitude"/>
            </when>
            <otherwise>
                <logger message="Geocoder did not return any results. Result: #[payload]" level="WARN" category="com.tbosa.esb.rpm" doc:name="Logger"/>
                <set-payload value="''" doc:name="Blank Value"/>
            </otherwise>
        </choice>
        <expression-component doc:name="Expression">Thread.sleep(${geocoder.throttle.delay});</expression-component>
    </ee:cache>
    <exception-strategy ref="EmailExceptionStrategy" doc:name="Exceptions"/>        
</flow>

The application hasn't changed. We've been running it successfully for 9 months, so I'm not sure where the issue might be. I'm honestly leaning toward an issue with Mulesoft, but they're trying to tell me this is an issue with the API. Thoughts?


Solution

  • 500 error indicates that something wrong happened on Google side during processing the request. Have you retried request after a short delay?

    Try to figure out which Google IP address hits your application. You can use traceroute maps.googleapis.com and ping maps.googleapis.com from the machine where you execute your application.

    If 500 error persists, I would suggest filing an issue in public issue tracker with your results from traceroute and ping, sample HTTP request that demonstrates the issue, your public IP address and your project number.

    https://code.google.com/p/gmaps-api-issues/

    Hope it helps!