COVID-19 data

Por Sourcerers | Actualizada hace 5 meses | Data

9.8 / 10



Nivel de servicio


Volver a todas las conversaciones

API call error

hace un año

I’m receiving error when the API is called of “You are not subscribed to this API”, when indeed I am subscriped and have API key for it. The free version.

React project, have the API key in * .env* and retrieving it with* process.env*

What may be causing the issue?

Thank you for your assistance

Gramzivi commented hace un año

See that you follow this example:
I see you had 3 successful requests in last week. Also, can you send full request (masking your API key), maybe there is some error in request structure?

LauraLeeLee commented hace un año

Thank you for your response.

I had success with requests last month and before…no problem with the calls, and with using this structure.
I took a pause from the code and returned to it.
It didn’t work for me this week at all, no successful requests on my end, I’d either get the ‘too many requests’ or the 'you are not subscribed to this API" message, no data.

Thank you for your assistance.

Here is my request…again same structure as before when it did work, I haven’t changed anything with it.

fetchCovid = async (country) => {
    const API_KEY = process.env.REACT_APP_COUNTRIES_API_KEY;
    const response = await fetch(
        'method': 'GET',
        'headers': {
          'x-rapidapi-host': '',
          'x-rapidapi-key': 'API_KEY',
    .then(response => response.json()
    ).then(data => {
      console.log("fetchCovd:", data);
      this.setState({apiData: [...this.state.apiData, data]});
      if(this.state.apiData.length > 0) {
      return data;
      .catch(err => {

I restructured the call to have it structured as per your indication to follow the example.

Same thing occurs, message of"You are not subscribed to this API"

LauraLeeLee commented hace un año

with my code above, if I plug the api-key directly into the call, the call works, retrieves the data.
That would be the 3 successful calls this week…4 counting today.

However I don’t want the api key in my code, I have it in the .env file.


Both log the api-key from the .env file correctly.

But when I have ‘API_KEY’ for the value in the call, it fails, renders message "You are not subscribed to this API"
I’m failing to see why the variable of the api key when applied in the call doesn’t work, especially when it did before. Problem occurred this week.

Thank you,

LauraLeeLee commented hace un año


For anyone else looking.

As I said, it was something I was overlooking.
In my .env file where I have the api key, at the end of the creation of the REACT_APP variable-- i had a semi colon at the end-- this was causing the issue with my key.

Works now.

Únase a la conversación, añada un comentario a continuación:

Inicie sesió/Regístrese para publicar nuevos comentarios
Valoración: 3.3 - Votos: 18