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

users with expired subscriptions #1634

Open
ftekkz opened this issue Feb 8, 2025 · 14 comments
Open

users with expired subscriptions #1634

ftekkz opened this issue Feb 8, 2025 · 14 comments

Comments

@ftekkz
Copy link

ftekkz commented Feb 8, 2025

After three months of successful operation of Marzban and its successive updates to version 0.8.4, a few days ago a problem appeared: I can no longer delete users with expired subscriptions using any of the methods I know of.

  1. Using a telegram bot – it doesn’t work.
  2. Using an API – it doesn’t work.
  3. When changing the corresponding parameter in the .env line – it also doesn’t work.
  4. I also tried through the DB, but due to the large number of links in the tables, I couldn’t do anything.
    When deleting Marzban using any of the listed methods, the following error was found in the logs (see attachment)
    When transferring a backup to a new server, the problem is also transferred.

Image

@ImMohammad20000
Copy link
Collaborator

Send the logs text

@ftekkz
Copy link
Author

ftekkz commented Feb 8, 2025

Send the logs text

  • "DELETE /api/user/eqQnAAOc HTTP/1.1" 500 Internal Server Error
    marzban-1 | ERROR: Exception in ASGI application
    marzban-1 | Traceback (most recent call last):
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
    marzban-1 | result = await app( # type: ignore[func-returns-value]
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
    marzban-1 | return await self.app(scope, receive, send)
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call
    marzban-1 | await super().call(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 113, in call
    marzban-1 | await self.middleware_stack(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in call
    marzban-1 | raise exc
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in call
    marzban-1 | await self.app(scope, receive, _send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in call
    marzban-1 | await self.simple_response(scope, receive, send, request_headers=headers)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/cors.py", line 144, in simple_response
    marzban-1 | await self.app(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in call
    marzban-1 | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    marzban-1 | raise exc
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    marzban-1 | await app(scope, receive, sender)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 715, in call
    marzban-1 | await self.middleware_stack(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
    marzban-1 | await route.handle(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
    marzban-1 | await self.app(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
    marzban-1 | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    marzban-1 | raise exc
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    marzban-1 | await app(scope, receive, sender)
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
    marzban-1 | response = await f(request)
    marzban-1 | ^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
    marzban-1 | raw_response = await run_endpoint_function(
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
    marzban-1 | return await run_in_threadpool(dependant.call, **values)
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/starlette/concurrency.py", line 39, in run_in_threadpool
    marzban-1 | return await anyio.to_thread.run_sync(func, *args)
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
    marzban-1 | return await get_async_backend().run_sync_in_worker_thread(
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread
    marzban-1 | return await future
    marzban-1 | ^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    marzban-1 | result = context.run(func, *args)
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/code/app/routers/user.py", line 152, in remove_user
    marzban-1 | report.user_deleted, username=dbuser.username, user_admin=Admin.model_validate(dbuser.admin), by=admin
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 627, in model_validate
    marzban-1 | return cls.pydantic_validator.validate_python(
    marzban-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    marzban-1 | pydantic_core._pydantic_core.ValidationError: 1 validation error for Admin
    marzban-1 | Input should be a valid dictionary or object to extract fields from [type=model_attributes_type, input_value=None, input_type=NoneType]
    marzban-1 | For further information visit https://errors.pydantic.dev/2.10/v/model_attributes_type

@ImMohammad20000
Copy link
Collaborator

Do you use environment variable for login?

@ftekkz
Copy link
Author

ftekkz commented Feb 8, 2025

Do you use environment variable for login?

using marzban cli I created a sudo administrator and only managed it through the dashboard and api, is that what you meant?

@ImMohammad20000
Copy link
Collaborator

this problem only happen if you use environment variables SUDO_USERNAME and SUDO_PASSWORD for login to panel SUDO_USERNAME and SUDO_PASSWORD for development you should use cli for create admin

@ftekkz
Copy link
Author

ftekkz commented Feb 8, 2025

SUDO_USERNAME and SUDO_PASSWORD

in the previous post i said i used cli to create admin but it didn't help, the problem remained. SUDO_USERNAME and SUDO_PASSWORD were originally commented out in .env and were never used.

@ImMohammad20000
Copy link
Collaborator

ImMohammad20000 commented Feb 8, 2025

what endpoint do you use?

@ftekkz
Copy link
Author

ftekkz commented Feb 8, 2025

what endpoint do you use?

Can you be more specific about what you mean, I don't understand what you mean by "endpoint"?

@ImMohammad20000
Copy link
Collaborator

can i see ur database?

@ftekkz
Copy link
Author

ftekkz commented Feb 8, 2025

can i see ur database?

I don't think it's safe, maybe there are other ways to help?

@ImMohammad20000
Copy link
Collaborator

Send me in telegram

@ftekkz
Copy link
Author

ftekkz commented Feb 11, 2025

Send me in telegram

Where i can find it?

@ImMohammad20000
Copy link
Collaborator

Send me in telegram

Where i can find it?

Same id in telegram

@AmirKenzo
Copy link

Image

Image

Hello, when we use the Marzban bot and create a user with it, the admin_id is set to NULL in the database, and we get this error.

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

3 participants