Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Server Error #43

Open
mr-n0cturne opened this issue Jun 30, 2023 · 2 comments
Open

Internal Server Error #43

mr-n0cturne opened this issue Jun 30, 2023 · 2 comments

Comments

@mr-n0cturne
Copy link

mr-n0cturne commented Jun 30, 2023

Hi,

im not able to authorize.

Commands and terminal output. I've added -s to supress the progress. Without -s same output.

[root@mysrv systools]$ TOKEN=$(curl -s -X POST -L -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=admin' http://127.0.0.1:8000/login/access-token/  | jq -r ".access_token")
[root@mysrv systools]$ echo $TOKEN
null
[root@mysrv systools]$ curl -L -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:8000/monitors/
Internal Server Error

docker logs

[2023-06-30 15:48:37 +0200] [1] [INFO] Starting gunicorn 20.1.0
[2023-06-30 15:48:37 +0200] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2023-06-30 15:48:37 +0200] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2023-06-30 15:48:37 +0200] [7] [INFO] Booting worker with pid: 7
[2023-06-30 15:48:38 +0200] [7] [INFO] Started server process [7]
[2023-06-30 15:48:38 +0200] [7] [INFO] Waiting for application startup.
[2023-06-30 15:48:38 +0200] [7] [INFO] KumaAPI started...
[2023-06-30 15:48:38 +0200] [7] [INFO] Application startup complete.
[2023-06-30 15:49:01 +0200] [7] [CRITICAL] hello from http://192.168.242.49:3001
[2023-06-30 15:49:01 +0200] [7] [INFO] Logged in to UptimeKuma
[2023-06-30 15:49:01 +0200] [7] [CRITICAL] 'token'
[2023-06-30 15:49:16 +0200] [7] [ERROR] Exception in ASGI application
Traceback (most recent call last):
  File "/app/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 180, in _load
    signing_input, crypto_segment = jwt.rsplit(b'.', 1)
ValueError: not enough values to unpack (expected 2, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/app/venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/app/venv/lib/python3.9/site-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/app/venv/lib/python3.9/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/app/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/app/venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 75, in __call__
    raise exc
  File "/app/venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 64, in __call__
    await self.app(scope, receive, sender)
  File "/app/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/app/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/app/venv/lib/python3.9/site-packages/fastapi/routing.py", line 221, in app
    solved_result = await solve_dependencies(
  File "/app/venv/lib/python3.9/site-packages/fastapi/dependencies/utils.py", line 533, in solve_dependencies
    solved = await call(**sub_values)
  File "/app/utils/deps.py", line 20, in get_current_user
    payload = jwt.decode(
  File "/app/venv/lib/python3.9/site-packages/jwt/api_jwt.py", line 84, in decode
    payload, _, _, _ = self._load(jwt)
  File "/app/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 183, in _load
    raise DecodeError('Not enough segments')
jwt.exceptions.DecodeError: Not enough segments

My docker-compose.yml

  uptime-kuma:
    image: louislam/uptime-kuma:alpine
    container_name: uptime-kuma
    volumes:
      - /share/CACHEDEV1_DATA/Container/uptime-kuma:/app/data
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - TZ=Europe/Berlin
    restart: always
    mac_address: 24:5E:BE:00:00:49
    networks:
      myBridgeNet:
        ipv4_address: 192.168.242.49


  uptime-kuma-api:
    container_name: uptime-kuma-api
    image: medaziz11/uptimekuma_restapi:latest
    volumes:
      - /share/CACHEDEV1_DATA/Container/uptime-kuma/api:/db:rw
      - /etc/localtime:/etc/localtime:ro
    restart: always
    environment:
      - TZ=Europe/Berlin
      - PUID=1000
      - PGID=1000
      - KUMA_SERVER=http://192.168.242.49:3001
      - KUMA_USERNAME=admin
      - KUMA_PASSWORD=UptimeKuma_PASSWORD
      - ADMIN_PASSWORD=admin
      - SECRET_KEY=UptimeKuma_API_TOKEN
    depends_on:
      - uptime-kuma
    ports:
      - 8000:8000
@mr-n0cturne
Copy link
Author

Any ideas?

@BouncySteak
Copy link

Try removing the trailing backslash from you get token.

Replicating error

Input
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=admin' http://127.0.0.1:8000/login/access-token/
Output
nothing (literally)

Possible fix

Input
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' --data 'username=admin&password=admin' http://127.0.0.1:8000/login/access-token
Note: See how there is no "/" after access-token

Output

{"access_token":"eyJ0eXAiOiJKV1Qi.................................................","token_type":"bearer"}

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

No branches or pull requests

2 participants