Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Request without data but status 200 #3

Open
Jeromearsene opened this issue Feb 14, 2021 · 5 comments
Open

Request without data but status 200 #3

Jeromearsene opened this issue Feb 14, 2021 · 5 comments

Comments

@Jeromearsene
Copy link

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

@CraigRL1971
Copy link

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

header

response

@alexalpek
Copy link

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

@samuelalsup
Copy link

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

@lespiper
Copy link

lespiper commented Jun 3, 2023

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?

@mtmail
Copy link

mtmail commented Jun 3, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants