Closed michael-genson closed 10 months ago
Hey! I have the same issue but I was not able to fix it by using the nightly tagged image.
During pod startup during the running of migrations I see an excpetion. After this the container correctly starts but I cannot login (observing the error message in this issue)
```text
INFO: 29-Nov-23 15:19:43 Database connection established.
INFO: 29-Nov-23 15:19:43 Context impl PostgresqlImpl.
INFO: 29-Nov-23 15:19:43 Will assume transactional DDL.
INFO: 29-Nov-23 15:19:43 Migration needed. Performing migration...
INFO: 29-Nov-23 15:19:43 Context impl PostgresqlImpl.
INFO: 29-Nov-23 15:19:43 Will assume transactional DDL.
INFO: 29-Nov-23 15:19:43 Running upgrade 44e8d670719d -> 2ea7a807915c, add recipe_timeline_events table
INFO: 29-Nov-23 15:19:43 Running upgrade 2ea7a807915c -> 1923519381ad, added recipe last made timestamp
INFO: 29-Nov-23 15:19:43 Running upgrade 1923519381ad -> 167eb69066ad, add recipe_scale to shopping list item ref
INFO: 29-Nov-23 15:19:43 Running upgrade 167eb69066ad -> 165d943c64ee, add related user to mealplan
INFO: 29-Nov-23 15:19:43 Running upgrade 165d943c64ee -> ff5f73b01a7a, add missing foreign key and order indices
INFO: 29-Nov-23 15:19:45 Running upgrade ff5f73b01a7a -> 16160bf731a0, add more indices necessary for search
INFO: 29-Nov-23 15:19:45 Running upgrade 16160bf731a0 -> 5ab195a474eb, add normalized search properties
INFO: 29-Nov-23 15:19:45 Running upgrade 5ab195a474eb -> b04a08da2108, added shopping list label settings
INFO: 29-Nov-23 15:19:46 Running upgrade b04a08da2108 -> 38514b39a824, add auth_method to user table
INFO: 29-Nov-23 15:19:46 Running upgrade 38514b39a824 -> b3dbb554ba53, postgres fuzzy search
INFO: 29-Nov-23 15:19:46 Running upgrade b3dbb554ba53 -> 04ac51cbe9a4, added group slug
INFO: 29-Nov-23 15:19:46 Running upgrade 04ac51cbe9a4 -> 1825b5225403, added recipe note to shopping list recipe ref
INFO: 29-Nov-23 15:19:46 Running upgrade 1825b5225403 -> bcfdad6b7355, remove tool name and slug unique contraints
INFO: 29-Nov-23 15:19:46 Running upgrade bcfdad6b7355 -> 0341b154f79a, added normalized unit and food names
INFO: 29-Nov-23 15:19:46 Running upgrade 0341b154f79a -> dded3119c1fe, added unique constraints
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
self.dialect.do_execute(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.UndefinedColumn: column ingredient_foods.plural_name does not exist
LINE 1: ..., ingredient_foods.name AS ingredient_foods_name, ingredient...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/mealie/db/init_db.py", line 110, in
```json { "theme": { "light_primary": "#E58325", "light_accent": "#007A99", "light_secondary": "#973542", "light_success": "#43A047", "light_info": "#1976D2", "light_warning": "#FF6D00", "light_error": "#EF5350", "dark_primary": "#E58325", "dark_accent": "#007A99", "dark_secondary": "#973542", "dark_success": "#43A047", "dark_info": "#1976D2", "dark_warning": "#FF6D00", "dark_error": "#EF5350" }, "PRODUCTION": true, "BASE_URL": "https://redacted.redacted.baseurl", "STATIC_FILES": "/spa/static", "IS_DEMO": false, "API_PORT": 9000, "API_DOCS": true, "TOKEN_TIME": 48, "LOG_LEVEL": "INFO", "GIT_COMMIT_HASH": "5ee077e09faf5408af64e5afcb93a4961a7bc37d", "ALLOW_SIGNUP": true, "SECURITY_MAX_LOGIN_ATTEMPTS": 5, "SECURITY_USER_LOCKOUT_TIME": 24, "DB_ENGINE": "postgres", "DEFAULT_GROUP": "Home", "SMTP_HOST": null, "SMTP_PORT": "587", "SMTP_FROM_NAME": "Mealie", "SMTP_FROM_EMAIL": null, "SMTP_AUTH_STRATEGY": "TLS", "LDAP_AUTH_ENABLED": false, "LDAP_SERVER_URL": null, "LDAP_TLS_INSECURE": false, "LDAP_TLS_CACERTFILE": null, "LDAP_ENABLE_STARTTLS": false, "LDAP_BASE_DN": null, "LDAP_QUERY_BIND": null, "LDAP_QUERY_PASSWORD": null, "LDAP_USER_FILTER": null, "LDAP_ADMIN_FILTER": null, "LDAP_ID_ATTRIBUTE": "uid", "LDAP_MAIL_ATTRIBUTE": "mail", "LDAP_NAME_ATTRIBUTE": "name", "TESTING": false } ```
```text INFO: 10.244.0.29:57512 - "POST /api/auth/token HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context self.dialect.do_execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedColumn: column users.auth_method does not exist LINE 1: ...ame, users.username, users.email, users.password, users.auth... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi result = await app( # type: ignore[func-returns-value] File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1106, in __call__ await super().__call__(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__ raise exc File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__ await responder(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__ await self.app(scope, receive, self.send_with_gzip) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ raise exc File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__ raise e File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__ await self.app(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 274, in app raw_response = await run_endpoint_function( File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/app/mealie/routes/auth/auth.py", line 73, in get_token user = authenticate_user(session, email, password) # type: ignore File "/app/mealie/core/security/security.py", line 51, in authenticate_user user = db.users.get_one(email, "email", any_case=True) File "/app/mealie/repos/repository_generic.py", line 159, in get_one result = self.session.execute(q).unique().scalars().one_or_none() File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2246, in execute return self._execute_internal( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2141, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute return meth( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection return connection._execute_clauseelement( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement ret = self._execute_context( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context return self._exec_single_context( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context self._handle_dbapi_exception( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2339, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context self.dialect.do_execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column users.auth_method does not exist LINE 1: ...ame, users.username, users.email, users.password, users.auth... ^ [SQL: SELECT users.id, users.full_name, users.username, users.email, users.password, users.auth_method, users.admin, users.advanced, users.group_id, users.cache_key, users.login_attemps, users.locked_at, users.can_manage, users.can_invite, users.can_organize, users.owned_recipes_id, users.created_at, users.update_at, groups_1.id AS id_1, groups_1.name, groups_1.slug, groups_1.created_at AS created_at_1, groups_1.update_at AS update_at_1, long_live_tokens_1.name AS name_1, long_live_tokens_1.token, long_live_tokens_1.user_id, long_live_tokens_1.id AS id_2, long_live_tokens_1.created_at AS created_at_2, long_live_tokens_1.update_at AS update_at_2 FROM users LEFT OUTER JOIN groups AS groups_1 ON groups_1.id = users.group_id LEFT OUTER JOIN long_live_tokens AS long_live_tokens_1 ON users.id = long_live_tokens_1.user_id WHERE lower(users.email) = %(lower_1)s] [parameters: {'lower_1': 'myemailaddressthat@iuseformealie.fake'}] (Background on this error at: https://sqlalche.me/e/20/f405) ```
My full deployment config is here: https://github.com/WesleyKlop/infrastructure/tree/main/apps/mealie/javelin https://github.com/WesleyKlop/infrastructure/tree/main/apps/mealie/base
Hey! I have the same issue but I was not able to fix it by using the nightly tagged image.
This is a different issue, just opened a PR for it - https://github.com/mealie-recipes/mealie/pull/2773
I can't reproduce this anymore since #2773 so I'm going to say it's resolved until someone else says otherwise. https://github.com/mealie-recipes/mealie/pull/2795 also added better logs for backups which should help
@michael-genson I have just updated from 0.5.x to 1.1.0, and I do have the same issues. Here are the logs I get on the console:
INFO: 62.214.6.66:0 - "POST /api/auth/token HTTP/1.0" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
self.dialect.do_execute(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.UndefinedColumn: column long_live_tokens_1.user_id does not exist
LINE 2: ...g_live_tokens AS long_live_tokens_1 ON users.id = long_live_...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
await responder(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__
await self.app(scope, receive, self.send_with_gzip)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 762, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 782, in app
await route.handle(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
await self.app(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
response = await func(request)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/app/mealie/routes/auth/auth.py", line 74, in get_token
user = authenticate_user(session, email, password) # type: ignore
File "/app/mealie/core/security/security.py", line 51, in authenticate_user
user = db.users.get_one(email, "email", any_case=True)
File "/app/mealie/repos/repository_generic.py", line 159, in get_one
result = self.session.execute(q).unique().scalars().one_or_none()
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2246, in execute
return self._execute_internal(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2141, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
result = conn.execute(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute
return meth(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection
return connection._execute_clauseelement(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement
ret = self._execute_context(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context
return self._exec_single_context(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context
self._handle_dbapi_exception(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2339, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
self.dialect.do_execute(
File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column long_live_tokens_1.user_id does not exist
LINE 2: ...g_live_tokens AS long_live_tokens_1 ON users.id = long_live_...
^
[SQL: SELECT users.id, users.full_name, users.username, users.email, users.password, users.auth_method, users.admin, users.advanced, users.group_id, users.cache_key, users.login_attemps, users.locked_at, users.can_manage, users.can_invite, users.can_organize, users.owned_recipes_id, users.created_at, users.update_at, groups_1.id AS id_1, groups_1.name, groups_1.slug, groups_1.created_at AS created_at_1, groups_1.update_at AS update_at_1, long_live_tokens_1.name AS name_1, long_live_tokens_1.token, long_live_tokens_1.user_id, long_live_tokens_1.id AS id_2, long_live_tokens_1.created_at AS created_at_2, long_live_tokens_1.update_at AS update_at_2
FROM users LEFT OUTER JOIN groups AS groups_1 ON groups_1.id = users.group_id LEFT OUTER JOIN long_live_tokens AS long_live_tokens_1 ON users.id = long_live_tokens_1.user_id
WHERE lower(users.email) = %(lower_1)s]
[parameters: {'lower_1': '****'}]
(Background on this error at: https://sqlalche.me/e/20/f405)
It would be great to have a fix for it, so I can use my recipes again. Is there maybe some SQL query / migration I can run manually?
Thanks a lot!
hey this would be a different issue all together, as beta5 and v0.5.6 do not have much in common.
Did you follow the migration guide? https://nightly.mealie.io/documentation/getting-started/migrating-to-mealie-v1/
If you did, please open a seperate issue
Thank you for the quick response! I'll follow the instructions now.
First Check
What is the issue you are experiencing?
A user reported in Discord that they were unable to upgrade from beta5 to RC2 with the reported error:
I had the user first upgrade to omni-nightly, then upgrade to RC2, and they reported it was successful. The error is similar to the one I fixed in https://github.com/mealie-recipes/mealie/pull/2760: I suspect alembic is calling a query on the user model at some point, which automatically tries to select the
auth_method
column (which doesn't exist yet due to a pending migration), and fails. More investigation is needed. Assuming I'm right, the solution is to lazy load columns (see https://github.com/mealie-recipes/mealie/pull/2760).Until this is fixed, a quick workaround is to first upgrade to omni nightly, then upgrade to whichever version you're trying to target (in this case: RC2).
Steps to Reproduce
1) Have a beta5 instance 2) Try to migrate directly to RC2
Please provide relevant logs
Mealie Version
beta 5 -> RCx
Deployment
Docker (Linux)
Additional Deployment Details
No response