MedAziz11 / Uptime-Kuma-Web-API

Uptime Kuma REST API
198 stars 41 forks source link

Could not resolve host #73

Open Tealk opened 3 months ago

Tealk commented 3 months ago

somehow i can't access the api even though the container is running.

curl -X -L 'POST' -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=XXX' http://127.0.0.1:8000/login/access-token/
curl: (6) Could not resolve host: POST
Invalid HTTP request received.
netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      621/nginx: master p 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      551/sshd: /usr/sbin 
tcp        0      0 0.0.0.0:3001            0.0.0.0:*               LISTEN      2846279/docker-prox 
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      839/exim4           
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      621/nginx: master p 
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      2846145/docker-prox 
tcp6       0      0 :::80                   :::*                    LISTEN      621/nginx: master p 
tcp6       0      0 :::22                   :::*                    LISTEN      551/sshd: /usr/sbin 
tcp6       0      0 :::3001                 :::*                    LISTEN      2846285/docker-prox 
tcp6       0      0 ::1:25                  :::*                    LISTEN      839/exim4           
tcp6       0      0 :::443                  :::*                    LISTEN      621/nginx: master p 
tcp6       0      0 :::8000                 :::*                    LISTEN      2846149/docker-prox 

log:

backend      | [2024-06-01 12:24:32 +0000] [1] [INFO] Starting gunicorn 20.1.0
backend      | [2024-06-01 12:24:32 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
backend      | [2024-06-01 12:24:32 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker
backend      | [2024-06-01 12:24:32 +0000] [6] [INFO] Booting worker with pid: 6
backend      | [2024-06-01 12:24:33 +0000] [6] [INFO] Started server process [6]
backend      | [2024-06-01 12:24:33 +0000] [6] [INFO] Waiting for application startup.
backend      | [2024-06-01 12:24:33 +0000] [6] [INFO] KumaAPI started...
backend      | [2024-06-01 12:24:33 +0000] [6] [INFO] Application startup complete.
backend      | [2024-06-01 12:25:04 +0000] [6] [WARNING] Invalid HTTP request received.
backend      | [2024-06-01 12:25:18 +0000] [6] [ERROR] Exception in ASGI application
backend      | Traceback (most recent call last):
backend      |   File "/app/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 180, in _load
backend      |     signing_input, crypto_segment = jwt.rsplit(b'.', 1)
backend      | ValueError: not enough values to unpack (expected 2, got 1)
backend      | 
backend      | During handling of the above exception, another exception occurred:
backend      | 
backend      | Traceback (most recent call last):
backend      |   File "/app/venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi
backend      |     result = await app(  # type: ignore[func-returns-value]
backend      |   File "/app/venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
backend      |     return await self.app(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/applications.py", line 270, in __call__
backend      |     await super().__call__(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/applications.py", line 124, in __call__
backend      |     await self.middleware_stack(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
backend      |     raise exc
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
backend      |     await self.app(scope, receive, _send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 75, in __call__
backend      |     raise exc
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 64, in __call__
backend      |     await self.app(scope, receive, sender)
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
backend      |     raise e
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
backend      |     await self.app(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 680, in __call__
backend      |     await route.handle(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 275, in handle
backend      |     await self.app(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
backend      |     response = await func(request)
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/routing.py", line 221, in app
backend      |     solved_result = await solve_dependencies(
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 533, in solve_dependencies
backend      |     solved = await call(**sub_values)
backend      |   File "/app/utils/deps.py", line 20, in get_current_user
backend      |     payload = jwt.decode(
backend      |   File "/app/venv/lib/python3.9/site-packages/jwt/api_jwt.py", line 84, in decode
backend      |     payload, _, _, _ = self._load(jwt)
backend      |   File "/app/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 183, in _load
backend      |     raise DecodeError('Not enough segments')
backend      | jwt.exceptions.DecodeError: Not enough segments
backend      | [2024-06-01 12:26:20 +0000] [6] [WARNING] Invalid HTTP request received.
backend      | [2024-06-01 12:26:30 +0000] [6] [WARNING] Invalid HTTP request received.
backend      | [2024-06-01 12:26:38 +0000] [6] [WARNING] Invalid HTTP request received.
backend      | [2024-06-01 12:26:53 +0000] [6] [ERROR] Exception in ASGI application
backend      | Traceback (most recent call last):
backend      |   File "/app/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 180, in _load
backend      |     signing_input, crypto_segment = jwt.rsplit(b'.', 1)
backend      | ValueError: not enough values to unpack (expected 2, got 1)
backend      | 
backend      | During handling of the above exception, another exception occurred:
backend      | 
backend      | Traceback (most recent call last):
backend      |   File "/app/venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi
backend      |     result = await app(  # type: ignore[func-returns-value]
backend      |   File "/app/venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
backend      |     return await self.app(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/applications.py", line 270, in __call__
backend      |     await super().__call__(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/applications.py", line 124, in __call__
backend      |     await self.middleware_stack(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
backend      |     raise exc
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
backend      |     await self.app(scope, receive, _send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 75, in __call__
backend      |     raise exc
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 64, in __call__
backend      |     await self.app(scope, receive, sender)
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
backend      |     raise e
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
backend      |     await self.app(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 680, in __call__
backend      |     await route.handle(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 275, in handle
backend      |     await self.app(scope, receive, send)
backend      |   File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
backend      |     response = await func(request)
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/routing.py", line 221, in app
backend      |     solved_result = await solve_dependencies(
backend      |   File "/app/venv/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 533, in solve_dependencies
backend      |     solved = await call(**sub_values)
backend      |   File "/app/utils/deps.py", line 20, in get_current_user
backend      |     payload = jwt.decode(
backend      |   File "/app/venv/lib/python3.9/site-packages/jwt/api_jwt.py", line 84, in decode
backend      |     payload, _, _, _ = self._load(jwt)
backend      |   File "/app/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 183, in _load
backend      |     raise DecodeError('Not enough segments')
backend      | jwt.exceptions.DecodeError: Not enough segments
backend      | [2024-06-01 12:27:00 +0000] [6] [WARNING] Invalid HTTP request received.
lum3n commented 1 month ago

I think this a mistake in the example:

curl -L = location
curl -X = request

curl -X -L 'POST' -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=XXX' http://127.0.0.1:8000/login/access-token/ makes no sense. It must be:

curl -X 'POST' -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=XXX' -L http://127.0.0.1:8000/login/access-token/