Closed Darskiy closed 4 months ago
Hello! 👋 Thank you for opening your first issue. We appreciate your contribution! 🎉
looks like the *.mo
files were not compiled when docker container was launched.
try compile locales with a separate command like:
python -m pybabel compile -d bot/locales
and show output
looks like the
*.mo
files were not compiled when docker container was launched. try compile locales with a separate command like:python -m pybabel compile -d bot/locales
and show output
/usr/src/app $ python -m pybabel compile -d bot/locales
/usr/local/bin/python: No module named pybabel
/usr/src/app $ python -m pip install pybabel
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pybabel in /usr/local/lib/python3.12/site-packages (0.0.0.dev0)
But if you manually enter the command from the docker runner pybabel compile -d bot/locales
, then everything is ok.
/usr/src/app $ pybabel compile -d bot/locales
compiling catalog bot/locales/en/LC_MESSAGES/messages.po to bot/locales/en/LC_MESSAGES/messages.mo
compiling catalog bot/locales/ru/LC_MESSAGES/messages.po to bot/locales/ru/LC_MESSAGES/messages.mo
compiling catalog bot/locales/uk/LC_MESSAGES/messages.po to bot/locales/uk/LC_MESSAGES/messages.mo
🤔
It is strange that literally the same command from the docker runner, but entered manually, fixed the localization error.
But now there is another error related to the absence of the users
table in the database
2024-04-07 00:02:50 bot | 2024-04-06 21:02:50.140 | INFO | bot.middlewares.logging:__call__:113 - received message | chat_type: private | user_id: 192005446 | text: /start
2024-04-07 00:02:50 postgres | 2024-04-06 21:02:50.143 UTC [60] ERROR: relation "users" does not exist at character 23
2024-04-07 00:02:50 postgres | 2024-04-06 21:02:50.143 UTC [60] STATEMENT: SELECT users.id
2024-04-07 00:02:50 postgres | FROM users
2024-04-07 00:02:50 postgres | WHERE users.id = $1::INTEGER
2024-04-07 00:02:50 postgres | LIMIT $2::INTEGER
2024-04-07 00:02:50 bot | Cause exception while process update id=368611995 by bot id=6945255203
2024-04-07 00:02:50 bot | ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedTableError'>: relation "users" does not exist
2024-04-07 00:02:50 bot | [SQL: SELECT users.id
2024-04-07 00:02:50 bot | FROM users
2024-04-07 00:02:50 bot | WHERE users.id = $1::INTEGER
2024-04-07 00:02:50 bot | LIMIT $2::INTEGER]
2024-04-07 00:02:50 bot | [parameters: (192005446, 1)]
2024-04-07 00:02:50 bot | (Background on this error at: https://sqlalche.me/e/20/f405)
2024-04-07 00:02:50 bot | Traceback (most recent call last):
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 514, in _prepare_and_execute
2024-04-07 00:02:50 bot | prepared_stmt, attributes = await adapt_connection._prepare(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 765, in _prepare
2024-04-07 00:02:50 bot | prepared_stmt = await self._connection.prepare(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/asyncpg/connection.py", line 636, in prepare
2024-04-07 00:02:50 bot | return await self._prepare(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/asyncpg/connection.py", line 654, in _prepare
2024-04-07 00:02:50 bot | stmt = await self._get_statement(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/asyncpg/connection.py", line 433, in _get_statement
2024-04-07 00:02:50 bot | statement = await self._protocol.prepare(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "asyncpg/protocol/protocol.pyx", line 166, in prepare
2024-04-07 00:02:50 bot | asyncpg.exceptions.UndefinedTableError: relation "users" does not exist
2024-04-07 00:02:50 bot |
2024-04-07 00:02:50 bot | The above exception was the direct cause of the following exception:
2024-04-07 00:02:50 bot |
2024-04-07 00:02:50 bot | Traceback (most recent call last):
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1971, in _exec_single_context
2024-04-07 00:02:50 bot | self.dialect.do_execute(
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 919, in do_execute
2024-04-07 00:02:50 bot | cursor.execute(statement, parameters)
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 572, in execute
2024-04-07 00:02:50 bot | self._adapt_connection.await_(
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 131, in await_only
2024-04-07 00:02:50 bot | return current.driver.switch(awaitable) # type: ignore[no-any-return]
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
2024-04-07 00:02:50 bot | value = await result
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 550, in _prepare_and_execute
2024-04-07 00:02:50 bot | self._handle_exception(error)
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 501, in _handle_exception
2024-04-07 00:02:50 bot | self._adapt_connection._handle_exception(error)
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 789, in _handle_exception
2024-04-07 00:02:50 bot | raise translated_error from error
2024-04-07 00:02:50 bot | sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_dbapi.ProgrammingError: <class 'asyncpg.exceptions.UndefinedTableError'>: relation "users" does not exist
2024-04-07 00:02:50 bot |
2024-04-07 00:02:50 bot | The above exception was the direct cause of the following exception:
2024-04-07 00:02:50 bot |
2024-04-07 00:02:50 bot | Traceback (most recent call last):
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/dispatcher.py", line 309, in _process_update
2024-04-07 00:02:50 bot | response = await self.feed_update(bot, update, **kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/dispatcher.py", line 158, in feed_update
2024-04-07 00:02:50 bot | response = await self.update.wrap_outer_middleware(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in __call__
2024-04-07 00:02:50 bot | return await handler(event, data)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in __call__
2024-04-07 00:02:50 bot | return await handler(event, data)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/fsm/middleware.py", line 41, in __call__
2024-04-07 00:02:50 bot | return await handler(event, data)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/src/app/bot/middlewares/logging.py", line 165, in __call__
2024-04-07 00:02:50 bot | return await handler(event, data)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/src/app/bot/middlewares/database.py", line 23, in __call__
2024-04-07 00:02:50 bot | return await handler(event, data)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 00:02:50 bot | return await wrapped_inner(event, kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 00:02:50 bot | return await wrapped()
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/dispatcher.py", line 276, in _listen_update
2024-04-07 00:02:50 bot | return await self.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 00:02:50 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/src/app/bot/middlewares/throttling.py", line 27, in __call__
2024-04-07 00:02:50 bot | return await handler(event, data)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 00:02:50 bot | return await self._propagate_event(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 00:02:50 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 00:02:50 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 00:02:50 bot | return await self._propagate_event(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 00:02:50 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 00:02:50 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 00:02:50 bot | return await self._propagate_event(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/router.py", line 148, in _propagate_event
2024-04-07 00:02:50 bot | response = await observer.trigger(event, **kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 00:02:50 bot | return await wrapped_inner(event, kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/src/app/bot/middlewares/auth.py", line 34, in __call__
2024-04-07 00:02:50 bot | if await user_exists(session, user.id):
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/src/app/bot/cache/redis.py", line 60, in wrapper
2024-04-07 00:02:50 bot | result = await func(*args, **kwargs)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/src/app/bot/services/users.py", line 47, in user_exists
2024-04-07 00:02:50 bot | result = await session.execute(query)
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/ext/asyncio/session.py", line 461, in execute
2024-04-07 00:02:50 bot | result = await greenlet_spawn(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 201, in greenlet_spawn
2024-04-07 00:02:50 bot | result = context.throw(*sys.exc_info())
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2306, in execute
2024-04-07 00:02:50 bot | return self._execute_internal(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2191, in _execute_internal
2024-04-07 00:02:50 bot | result: Result[Any] = compile_state_cls.orm_execute_statement(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
2024-04-07 00:02:50 bot | result = conn.execute(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1422, in execute
2024-04-07 00:02:50 bot | return meth(
2024-04-07 00:02:50 bot | ^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 514, in _execute_on_connection
2024-04-07 00:02:50 bot | return connection._execute_clauseelement(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1644, in _execute_clauseelement
2024-04-07 00:02:50 bot | ret = self._execute_context(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1850, in _execute_context
2024-04-07 00:02:50 bot | return self._exec_single_context(
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1990, in _exec_single_context
2024-04-07 00:02:50 bot | self._handle_dbapi_exception(
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2357, in _handle_dbapi_exception
2024-04-07 00:02:50 bot | raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1971, in _exec_single_context
2024-04-07 00:02:50 bot | self.dialect.do_execute(
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 919, in do_execute
2024-04-07 00:02:50 bot | cursor.execute(statement, parameters)
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 572, in execute
2024-04-07 00:02:50 bot | self._adapt_connection.await_(
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 131, in await_only
2024-04-07 00:02:50 bot | return current.driver.switch(awaitable) # type: ignore[no-any-return]
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
2024-04-07 00:02:50 bot | value = await result
2024-04-07 00:02:50 bot | ^^^^^^^^^^^^
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 550, in _prepare_and_execute
2024-04-07 00:02:50 bot | self._handle_exception(error)
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 501, in _handle_exception
2024-04-07 00:02:50 bot | self._adapt_connection._handle_exception(error)
2024-04-07 00:02:50 bot | File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 789, in _handle_exception
2024-04-07 00:02:50 bot | raise translated_error from error
2024-04-07 00:02:50 bot | sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedTableError'>: relation "users" does not exist
2024-04-07 00:02:50 bot | [SQL: SELECT users.id
2024-04-07 00:02:50 bot | FROM users
2024-04-07 00:02:50 bot | WHERE users.id = $1::INTEGER
2024-04-07 00:02:50 bot | LIMIT $2::INTEGER]
2024-04-07 00:02:50 bot | [parameters: (192005446, 1)]
2024-04-07 00:02:50 bot | (Background on this error at: https://sqlalche.me/e/20/f405)
the problem with the missing table is due to the fact that you did not perform the migration
docker compose exec bot alembic upgrade head
also, after starting the bot container, check whether the required package is installed using the command pip freeze
:
pip freeze | grep Babel
Babel
package is included in the dependencies (pyproject.toml
). It's strange that in your case it is not visible
the problem with the missing table is due to the fact that you did not perform the migration
docker compose exec bot alembic upgrade head
Oh, really, I got stuck with these mistakes and even didn't pay attention to this step, My fault. Now, the error is generally related to amplitude:
2024-04-07 17:27:19 bot | 2024-04-07 14:27:19.341 | ERROR | bot.analytics.amplitude.client:_validate_response:43 - get error from amplitude api | error: Invalid API key: | code: 400
2024-04-07 17:27:19 bot | Cause exception while process update id=368612008 by bot id=6945255203
2024-04-07 17:27:19 bot | ValueError: Error in amplitude api call | error: Invalid API key: | code: 400
2024-04-07 17:27:19 bot | Traceback (most recent call last):
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 309, in _process_update
2024-04-07 17:27:19 bot | response = await self.feed_update(bot, update, **kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 158, in feed_update
2024-04-07 17:27:19 bot | response = await self.update.wrap_outer_middleware(
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/fsm/middleware.py", line 41, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/middlewares/logging.py", line 165, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/middlewares/database.py", line 23, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 17:27:19 bot | return await wrapped_inner(event, kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 17:27:19 bot | return await wrapped()
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 276, in _listen_update
2024-04-07 17:27:19 bot | return await self.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 17:27:19 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/middlewares/throttling.py", line 27, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 17:27:19 bot | return await self._propagate_event(
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 17:27:19 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 17:27:19 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 17:27:19 bot | return await self._propagate_event(
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 17:27:19 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 17:27:19 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 17:27:19 bot | return await self._propagate_event(
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 148, in _propagate_event
2024-04-07 17:27:19 bot | response = await observer.trigger(event, **kwargs)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 17:27:19 bot | return await wrapped_inner(event, kwargs)
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/middlewares/auth.py", line 43, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/utils/i18n/middleware.py", line 74, in __call__
2024-04-07 17:27:19 bot | return await handler(event, data)
2024-04-07 17:27:19 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 17:27:19 bot | return await wrapped()
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/services/analytics.py", line 55, in wrapper
2024-04-07 17:27:19 bot | await self.logger.log_event(
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/analytics/amplitude/client.py", line 54, in log_event
2024-04-07 17:27:19 bot | await self._send_request(event)
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/analytics/amplitude/client.py", line 35, in _send_request
2024-04-07 17:27:19 bot | self._validate_response(json_response)
2024-04-07 17:27:19 bot | File "/usr/src/app/bot/analytics/amplitude/client.py", line 45, in _validate_response
2024-04-07 17:27:19 bot | raise ValueError(msg)
2024-04-07 17:27:19 bot | ValueError: Error in amplitude api call | error: Invalid API key: | code: 400
also, after starting the bot container, check whether the required package is installed using the command
pip freeze
:pip freeze | grep Babel
Babel
package is included in the dependencies (pyproject.toml
). It's strange that in your case it is not visible
/usr/src/app $ pip freeze | grep Babel
Babel==2.14.0
also, after starting the bot container, check whether the required package is installed using the command
pip freeze
:pip freeze | grep Babel
Babel
package is included in the dependencies (pyproject.toml
). It's strange that in your case it is not visible/usr/src/app $ pip freeze | grep Babel Babel==2.14.0
if you have the Babel
package installed but calling python -m pybabel
doesn't work, then you should use the pybabel
command. anyway this means that the package was installed
are you sure that you have set amplitude api key in your .env
file?
are you sure that you have set amplitude api key in your
.env
file?
Of the .env
data, I have specified only the API token of the bot. I just copied the rest from .env.example
.
After all, the manual states that:
Environment variables to launch the bot you only need a token bot, database and redis settings, everything else can be left out
But the bot does not respond to the /start
command, and the error appears in the logs due to the absence of the amplitude api key.
are you sure that you have set amplitude api key in your
.env
file?Of the
.env
data, I have specified only the API token of the bot. I just copied the rest from.env.example
.After all, the manual states that:
to launch the bot you only need a token bot, database and redis settings, everything else can be left out
it is implied that before launching only the bot, these settings are needed. if you need analytics, of course you need an amplitude api key, how else can you work with amplitude
just don’t use analytics if you don't need it, but if you need it, you need to set API Key
just don’t use analytics if you don't need it, but if you need it, you need to set API Key
Understood, thanks. Now another error. This time related to the aiogram keyboard:
INFO | bot.middlewares.logging:__call__:113 - received message | chat_type: private | user_id: 192005446 | text: /supports
2024-04-07 19:28:10 bot | Cause exception while process update id=368612033 by bot id=6945255203
2024-04-07 19:28:10 bot | TelegramBadRequest: Telegram server says - Bad Request: can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard
2024-04-07 19:28:10 bot | Traceback (most recent call last):
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 309, in _process_update
2024-04-07 19:28:10 bot | response = await self.feed_update(bot, update, **kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 158, in feed_update
2024-04-07 19:28:10 bot | response = await self.update.wrap_outer_middleware(
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/fsm/middleware.py", line 41, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/src/app/bot/middlewares/logging.py", line 165, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/src/app/bot/middlewares/database.py", line 23, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 19:28:10 bot | return await wrapped_inner(event, kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 19:28:10 bot | return await wrapped()
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 276, in _listen_update
2024-04-07 19:28:10 bot | return await self.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 19:28:10 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 19:28:10 bot | File "/usr/src/app/bot/middlewares/throttling.py", line 27, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 19:28:10 bot | return await self._propagate_event(
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 19:28:10 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 19:28:10 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 19:28:10 bot | return await self._propagate_event(
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 19:28:10 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 19:28:10 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 19:28:10 bot | return await self._propagate_event(
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 148, in _propagate_event
2024-04-07 19:28:10 bot | response = await observer.trigger(event, **kwargs)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 19:28:10 bot | return await wrapped_inner(event, kwargs)
2024-04-07 19:28:10 bot | File "/usr/src/app/bot/middlewares/auth.py", line 35, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/utils/i18n/middleware.py", line 74, in __call__
2024-04-07 19:28:10 bot | return await handler(event, data)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 19:28:10 bot | return await wrapped()
2024-04-07 19:28:10 bot | File "/usr/src/app/bot/handlers/support.py", line 13, in support_handler
2024-04-07 19:28:10 bot | await message.answer(_("support text"), reply_markup=contacts_keyboard())
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/methods/base.py", line 84, in emit
2024-04-07 19:28:10 bot | return await bot(self)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/bot.py", line 492, in __call__
2024-04-07 19:28:10 bot | return await self.session(self, method, timeout=request_timeout)
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/session/base.py", line 254, in __call__
2024-04-07 19:28:10 bot | return cast(TelegramType, await middleware(bot, method))
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/session/aiohttp.py", line 178, in make_request
2024-04-07 19:28:10 bot | response = self.check_response(
2024-04-07 19:28:10 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/session/base.py", line 120, in check_response
2024-04-07 19:28:10 bot | raise TelegramBadRequest(method=method, message=description)
2024-04-07 19:28:10 bot | aiogram.exceptions.TelegramBadRequest: Telegram server says - Bad Request: can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard
2024-04-07 19:28:11 bot | 2024-04-07 16:28:11.479 | INFO | bot.middlewares.logging:__call__:113 - received message | chat_type: private | user_id: 192005446 | text: /contacts
2024-04-07 19:28:11 bot | Cause exception while process update id=368612034 by bot id=6945255203
2024-04-07 19:28:11 bot | TelegramBadRequest: Telegram server says - Bad Request: can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard
2024-04-07 19:28:11 bot | Traceback (most recent call last):
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 309, in _process_update
2024-04-07 19:28:11 bot | response = await self.feed_update(bot, update, **kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 158, in feed_update
2024-04-07 19:28:11 bot | response = await self.update.wrap_outer_middleware(
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/fsm/middleware.py", line 41, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/src/app/bot/middlewares/logging.py", line 165, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/src/app/bot/middlewares/database.py", line 23, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 19:28:11 bot | return await wrapped_inner(event, kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 19:28:11 bot | return await wrapped()
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 276, in _listen_update
2024-04-07 19:28:11 bot | return await self.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 19:28:11 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 19:28:11 bot | File "/usr/src/app/bot/middlewares/throttling.py", line 27, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 19:28:11 bot | return await self._propagate_event(
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 19:28:11 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 19:28:11 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 19:28:11 bot | return await self._propagate_event(
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 156, in _propagate_event
2024-04-07 19:28:11 bot | response = await router.propagate_event(update_type=update_type, event=event, **kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 128, in propagate_event
2024-04-07 19:28:11 bot | return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 123, in _wrapped
2024-04-07 19:28:11 bot | return await self._propagate_event(
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/router.py", line 148, in _propagate_event
2024-04-07 19:28:11 bot | response = await observer.trigger(event, **kwargs)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/telegram.py", line 121, in trigger
2024-04-07 19:28:11 bot | return await wrapped_inner(event, kwargs)
2024-04-07 19:28:11 bot | File "/usr/src/app/bot/middlewares/auth.py", line 35, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/utils/i18n/middleware.py", line 74, in __call__
2024-04-07 19:28:11 bot | return await handler(event, data)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/event/handler.py", line 43, in call
2024-04-07 19:28:11 bot | return await wrapped()
2024-04-07 19:28:11 bot | File "/usr/src/app/bot/handlers/support.py", line 13, in support_handler
2024-04-07 19:28:11 bot | await message.answer(_("support text"), reply_markup=contacts_keyboard())
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/methods/base.py", line 84, in emit
2024-04-07 19:28:11 bot | return await bot(self)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/bot.py", line 492, in __call__
2024-04-07 19:28:11 bot | return await self.session(self, method, timeout=request_timeout)
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/session/base.py", line 254, in __call__
2024-04-07 19:28:11 bot | return cast(TelegramType, await middleware(bot, method))
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/session/aiohttp.py", line 178, in make_request
2024-04-07 19:28:11 bot | response = self.check_response(
2024-04-07 19:28:11 bot | File "/usr/local/lib/python3.10/site-packages/aiogram/client/session/base.py", line 120, in check_response
2024-04-07 19:28:11 bot | raise TelegramBadRequest(method=method, message=description)
2024-04-07 19:28:11 bot | aiogram.exceptions.TelegramBadRequest: Telegram server says - Bad Request: can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard
I haven't changed anything, so the error is clearly on your side.
thanks, but so far I have not been able to reproduce this error
reproduced on Mac. after manual compiling bot starts correctly
this problem could occur due to the bot
container from the docker-compose.yml
used volume with the bot source code including dir bot/locales in which there were no compiled files (the compilation process was in Dockerfile
)
I removed the extra volumes and now compiled *.mo files remain in the container
System Information: