[Python] Djoser Login dosn't work with Docker-compose, Worker terminated with Signal 11

Discussão em 'Python' iniciado por Stack, Setembro 16, 2024.

  1. Stack

    Stack Membro Participativo

    I am currently working in a data warehouse with Django and React.

    For the Authentification is use Djoser, which worked really well when I don't deploy it with Docker.

    When I Deploy it with my Docker-Compose I can Create(register) a User and Activate it but when I try to Login the Worker terminate itself with Signal 11. At the same time, when I use the wrong Password, I get 401 Wrong Password.

    I'm pretty overwhelmed because it looks like it can access the DB (i use SQLite) because I can create the User.

    First, I tried to log in with Postman because I thought it would be a Frontend Problem, but it's not.

    Then I looked at the Network Timing on my browser, and it looks like it fails at the Initial connection when I use the right Parametes, with wrong Parameters the Request is ok without errors (just the 401)

    When I turn on the Loggin feature it looks like this:

    evse_v4_sprint-current-backend-1 | [2024-09-16 08:01:59 +0000] [33] [INFO] Booting worker with pid: 33
    evse_v4_sprint-current-backend-1 | (0.001) SELECT "user_useraccount"."id", "user_useraccount"."password", "user_useraccount"."last_login", "user_useraccount"."is_superuser", "user_useraccount"."email", "user_useraccount"."name", "user_useraccount"."is_active", "user_useraccount"."is_staff", "user_useraccount"."is_creator" FROM "user_useraccount" WHERE "user_useraccount"."email" = 'me@mail.com' LIMIT 21; args=('me@mail.com',); alias=users
    evse_v4_sprint-current-backend-1 | [2024-09-16 08:02:02 +0000] [32] [WARNING] Worker with pid 33 was terminated due to signal 11
    evse_v4_sprint-current-backend-1 | [2024-09-16 08:02:02 +0000] [41] [INFO] Booting worker with pid: 41


    My backend Docker file looks like:

    FROM python:3.10.6-alpine

    RUN pip install --upgrade pip

    #Set Work Direcotry
    COPY . /app
    COPY . /user
    WORKDIR /app
    #ADD * /app

    #Install Req
    COPY ./requirements.txt .
    RUN pip3 install -r requirements.txt



    COPY ./entrypoint.sh /
    ENTRYPOINT [ "sh", "/entrypoint.sh" ]


    and my entrypoint.sh:

    #!/bin/sh

    python manage.py makemigrations
    python manage.py migrate --no-input

    python manage.py migrate --database=users

    python manage.py collectstatic --no-input

    gunicorn settings.wsgi:application --bind 0.0.0.0:8000


    My Frontend code to login is:

    export const login = (email, password) => async dispatch => {
    const config = {
    headers: {
    'Content-Type': 'application/json'
    }
    };

    const body = JSON.stringify({ email, password });
    console.log("Try")
    try {

    // TODO: process.env.API_URL: setzen
    console.log(body, config)
    const res = await axios.post(API_URL + `/auth/jwt/create/`, body, config);
    console.log(res)
    dispatch({
    type: LOGIN_SUCCESS,
    payload: res.data
    });

    dispatch(load_user());
    } catch (err) {
    console.log("Err")
    console.log(err)
    dispatch({
    type: LOGIN_FAIL
    })
    }
    };


    Here the web console log looks like:

    Try

    {"email":"mail@mail.com","password":"Passwort123"} {headers: {…}} headers: [[Prototype]]: ObjectContent-Type: "application/json" [[Prototype]]: Object ERR

    B {message: 'Network Error', name*:* 'AxiosError', code*:* 'ERR_NETWORK', config*:* {…}, request*:* XMLHttpRequest, …}

    the axios.post ends in a Djoser function, therefor i cant say anything

    Continue reading...

Compartilhe esta Página