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

Telegram bot won't show the response of user creation when creating users #98

Closed
govfvck opened this issue Mar 17, 2023 · 0 comments
Closed
Labels
Bug Something isn't working

Comments

@govfvck
Copy link
Contributor

govfvck commented Mar 17, 2023

Describe the bug
Telegram bot won't show the response of user creation when creating the user with it.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the telegrom bot
  2. Click on 'create user'
  3. Enter the requested info
  4. select the desired protocols and click 'Done'
  5. user will be created in the database but the bot won't show any response

Expected behavior
when creating a new user from the telegram bot, the bot should create the user in the db and show the response of the operation to the user.

Machine details (please complete the following information):

  • OS: Ubuntu 22.04
  • Python version: 3.10.6

Additional context

Logs from the error:

2023-03-17 12:06:58,142 (__init__.py:960 Thread-1 (infinity_polling)) ERROR - TeleBot: "Infinity polling exception: Parent instance <User at 0x7fb6bc33dea0> is not bound to a Session; lazy l
oad operation of attribute 'proxies' cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)"
2023-03-17 12:06:58,143 (__init__.py:962 Thread-1 (infinity_polling)) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):                                                           
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/__init__.py", line 955, in infinity_polling
    self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout,    
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/__init__.py", line 1043, in polling
    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/__init__.py", line 1118, in __threaded_polling
    raise e                                                                                  
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/__init__.py", line 1074, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/util.py", line 156, in raise_exceptions
    raise self.exception_info
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/util.py", line 100, in run  
    task(*args, **kwargs)   
  File "/root/Marzban/.venv/lib/python3.10/site-packages/telebot/__init__.py", line 6395, in _run_middlewares_and_handler
    result = handler['function'](message)                                                    
  File "/root/Marzban/app/telegram/admin.py", line 451, in confirm_user_command
    ', '.join([p.type for p in db_user.proxies])                                             
  File "/root/Marzban/.venv/lib/python3.10/site-packages/sqlalchemy/orm/attributes.py", line 482, in __get__
    return self.impl.get(state, dict_)
  File "/root/Marzban/.venv/lib/python3.10/site-packages/sqlalchemy/orm/attributes.py", line 942, in get
    value = self._fire_loader_callables(state, key, passive)                                   
  File "/root/Marzban/.venv/lib/python3.10/site-packages/sqlalchemy/orm/attributes.py", line 978, in _fire_loader_callables
    return self.callable_(state, passive)                                                    
  File "/root/Marzban/.venv/lib/python3.10/site-packages/sqlalchemy/orm/strategies.py", line 863, in _load_for_state
    raise orm_exc.DetachedInstanceError( 
sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <User at 0x7fb6bc33dea0> is not bound to a Session; lazy load operation of attribute 'proxies' cannot proceed (Background on this er
ror at: https://sqlalche.me/e/14/bhk3)
@govfvck govfvck added the Bug Something isn't working label Mar 17, 2023
Alirezaja1384 added a commit to Alirezaja1384/Marzban that referenced this issue Mar 19, 2023
Details:
  - Fixes Gozargah#98
  - proxies retrieved inside db context to prevent DetachedInstanceError
@govfvck govfvck closed this as completed Mar 20, 2023
SaintShit pushed a commit that referenced this issue Mar 21, 2023
Details:
  - Fixes #98
  - proxies retrieved inside db context to prevent DetachedInstanceError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant