Google API Error OVER_QUERY_LIMIT & Empty Dashboard

5.2k views Asked by At

I'm receiving OVER_QUERY_LIMIT error intermittently when calling Google's Distance Matrix API.

After enabling billing it should not show this error since I could make 100,000 requests/day as per API documentation. Though, I'm making on 2500-2600 requests/day currently.

Also, API statistics report in Google Console project doesn't show any data for Distance Matrix API in the dashboard, however, it shows data for other APIs. See attachedenter image description here screenshot.

Error Message:

{
    "destination_addresses": [],
    "error_message": "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_",
    "origin_addresses": [],
    "rows": [],
    "status": "OVER_QUERY_LIMIT"
}
2

There are 2 answers

2
vishal savsani On BEST ANSWER

Thanks, @DaImTo & @Prisoner for looking into this.

It seems an issue is in Google's internal system. I resolved an issue with a tricky way. Here are my findings I would like to share so people can save time I wasted in debugging an issue.

  • The error that Google provides("OVER_QUERY_LIMIT") is something that misguides people. I just made few changes in API URL and it's working on.
  • Changed "HTTP" to "HTTPS"
  • Previously I was using "Key" and changed it to "key"

Incorrect : http://maps.googleapis.com/maps/api/distancematrix/json?&origins={origin}&destinations={destination}&sensor=false&Key={api_key}

Correct: https://maps.googleapis.com/maps/api/distancematrix/json?&origins={origin}&destinations={destination}&key={api_key}

Though, I'm still not sure why incorrect URL is working when I make a call from local machine but not on production server.

  1. Regarding usage statistics, it started showing API in dashboards as soon as I updated API URL.
1
Prisoner On

With billing enabled (and not with the premium service), you still have other limits in place. That you're getting this error intermittently suggests that you might be exceeding the 100 elements/second limit (which is averaged over 100 seconds, it looks like). See https://developers.google.com/maps/documentation/distance-matrix/usage-limits for the limits that are in place on each level.

Not all statistics are shown in the dashboard. You can go to the specific services page to see additional information and how it reflects the quotas.

enter image description here