farahat80 / react-open-weather

React open weather is a React Component loading forecast data from Various weather providers (currently OpenWeather, WeatherBit and VisualCrossing)
MIT License
115 stars 65 forks source link

Network Error on call useOpenWeather #80

Closed radekzz closed 2 months ago

radekzz commented 2 years ago

First of all, great job!!!

I have a problem when implemented a component, i'm getting Network Error. There is a blank page on screen and this error in console. This error disappear when i remove constant assignment.

Steps to reproduce in React Native app:

import ReactWeather, { useOpenWeather } from 'react-open-weather';

const { data, isLoading, errorMessage } = useOpenWeather({
    key: 'API-KEY',
    lat: '48',
    lon: '11',
    lang: 'en',
    unit: 'metric',
  });
<ReactWeather
          isLoading={isLoading}
          errorMessage={errorMessage}
          data={data}
          lang="en"
          locationLabel="Munich"
          unitsLabels={{ temperature: 'C', windSpeed: 'Km/h' }}
          showForecast
        />
farahat80 commented 2 years ago

@radekzz can you provide the error message?, looks to me like something is blocking the connection from your browser

baur commented 2 years ago

error from console http://api.openweathermap.org/data/2.5/onecall?appid={mykey}&lang=ru&units=metric&lat=51.1277&lon=71.4283

{"cod":401, "message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."}

But I'm passing 100% right API

baur commented 2 years ago

Possible reason:

You are using a Free subscription and try requesting data available in other subscriptions . For example, 16 days/daily forecast API, any historical weather data, Weather maps 2.0, etc). Please, check your subscription in your personal account

image

First 3 reasons excluded