positionstack icon indicating copy to clipboard operation
positionstack copied to clipboard

Request without data but status 200

Open Jeromearsene opened this issue 4 years ago • 5 comments

I make some request and sometimes, some of here return empty datas. This bug seems to be totally random. If y retry, this one can be good and another previously ok this one without datas.

Examples with St. Lucia:

# logger.info(query, results)
2021-02-14 02:41:18 info: St. Lucia [
  [
    []
  ]
]

# logger.info('Status:', response.status);
2021-02-14 02:41:18 info: Status: [
  200
]

# logger.info('Body:', response.body);
2021-02-14 02:41:18 info: Body: [
  {
    "data": [
      []
    ]
  }
]

My code:

 const params = {
    access_key: env.POSITIONSTACK_API_KEY,
    query,
    // fields: 'results.country_code',
    limit: 1,
    country_module: 1,
  };

  await sleep(retryCounter);
  try {
    const response = await superagent.get('http://api.positionstack.com/v1/forward').query(params);

    const results = response.body.data;

    if (results?.length > 0) {
      try {
        const {
          type,
          country_code: countryCode,
          region_code: regionCode,
          country_module: {
            global: { alpha2: countryAlpha2 },
          },
        } = results[0];

        logger.debug(
          `For ${query}:
        type: ${type}, countryCode: ${countryCode}, regionCode: ${regionCode}, country alpha 2: ${countryAlpha2}`
        );

        return {
          type,
          countryCode,
          regionCode,
          countryAlpha2,
        };
      } catch (error) {
        logger.error(error);
        logger.info(query, results);
        logger.info('Status:', response.status);
        logger.info('Body:', response.body);
      }
    }

When I test on your website, I have datas: Capture d’écran 2021-02-14 à 02 46 24

Jeromearsene avatar Feb 14 '21 01:02 Jeromearsene

I am seeing the exact same thing from this API, the response code is 200 but the data json object is empty.

header response

CraigRL1971 avatar Mar 06 '21 12:03 CraigRL1971

I am also having this issue. In my app, I am trying to get city coordinates, and it sometimes get data, sometimes, dont. error

alexalpek avatar May 12 '21 11:05 alexalpek

i have the same issue, did you guys figure out how to solve it?

samuelalsup avatar Nov 01 '22 19:11 samuelalsup

Is there no update on this issue? Open for over 2 years and nothing since Nov 2022?

Having this random problem too, checked my sub is active and updated my API key, my code has been working for some time and has not been changed. Looks like a you problem so how about an update?

lespiper avatar Jun 03 '23 06:06 lespiper

APIlayer employees are not present on their github repositories, even the "Are you guys still in business" issue from 2021 is unanswered.

On Twitter they're mostly unhelpful, too. Try their support email.

[Disclaimer: I work for a competitor in geocoding, feel free to test our support response time on any channel]

image

image

mtmail avatar Jun 03 '23 19:06 mtmail