Socket hang up using axios or request to get data from google geocoding api

I'm trying to iterate through a list of address and get their lat, lng coordinates via Google Geocoding API. Here is my code using axios

  list.forEach((item) => {
    item.address = item.address.replace(/\s{1}/g, '+');
      .then((result) => {

My issue is that no matter what, I seem to get this error Error: socket hang up and very infrequently Error: read ECONNRESET. I know the individual URLs are valid (if I console.log the URLs and visit them manually I do get the expected response) but when I run my code all I see are errors. I've also tried using the request library and I get the same result. The first several requests work without error, I get the occasional rate limited error, and then the above errors get logged to the console over and over again.

{ Error: socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1130:19)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at TLSSocket.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1047:12)
    at _combinedTickCallback (internal/process/next_tick.js:102:11)
    at process._tickDomainCallback (internal/process/next_tick.js:198:9) 
code: 'ECONNRESET' }

note: I have payment setup with Google API and I am well below my quota anyway, so I don't think the issue is on their end. I would provide a working example but I would rather not share my api key. Any help is greatly appreciated.



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.