Skip to content

[BUG] 401 HTTP-code with widget weather-forecast #621

Closed
@Himlol

Description

@Himlol

Environment

Self-Hosted (Docker)

Version

2.0.7

Describe the problem

Hello,

I think I've found a bug in using the openweathermap API (api.openweathermap.org) or the API's behavior has changed.

Problem:

I created a widget with weather-forecast and got 401 HTTP-code, where app try to send request.
image

Widget configuration in conf.yml looks like:

sections:
- name: Today
  icon: far fa-calendar-day
  widgets:
  - type: weather-forecast
    options:
      apiKey: <API_KEY>
      numDays: 6
      city: London
      units: metric

On Network tabs i see request like:

image

Then i try repeat request with curl and it's really response 401:

curl -v "https://api.openweathermap.org/data/2.5/forecast/daily?q=London&cnt=3&units=metric&appid=<API_KEY>" -o /dev/null

> GET /data/2.5/forecast/daily?q=London&cnt=3&units=metric&appid=<API_KEY>
HTTP/1.1
> Host: api.openweathermap.org
> User-Agent: curl/7.68.0
> Accept: */*
>

< HTTP/1.1 401 Unauthorized
< Server: openresty
< Date: Fri, 29 Apr 2022 11:07:14 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 107
< Connection: keep-alive
< X-Cache-Key: /data/2.5/forecast/daily?cnt=3&q=london,us&units=metric
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET, POST

But if try send request without daily, it's works fine:

curl -v "https://api.openweathermap.org/data/2.5/forecast/?q=London&cnt=3&units=metric&appid=<API_KEY>" -o /dev/null

> GET /data/2.5/forecast/?q=London&cnt=3&units=metric&appid=<API_KEY>
 HTTP/1.1
> Host: api.openweathermap.org
> User-Agent: curl/7.68.0
> Accept: */*
>

< HTTP/1.1 200 OK
< Server: openresty
< Date: Fri, 29 Apr 2022 11:08:36 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 1389
< Connection: keep-alive
< X-Cache-Key: /data/2.5/forecast/?cnt=3&q=london&units=metric
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET, POST

Maybe I missed something, but it looks like an invalid API request. Hope for your update)

Additional info

No response

Please tick the boxes

Metadata

Metadata

Assignees

Labels

🐛 Bug[ISSUE] Ticket describing something that isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions