Closed mikhail5555 closed 9 months ago
interesting I thought I had fixed this specific issue. need to look again.
this is very very strange. @nicedevil007 and @Mikhail5555 you both are 100% sure that if you update to 1.5.11 this error appears and that rolling back to 1.5.10 its broken?
Because I thought 1.5.10 was broken and I fixed it in 1.5.11. And I just prepared two databases, one postgres one sqlite, added the 2345232-cherry
food and migrated from 1.5.10 to 1.5.11
ok so looking at this again, you should have had this issue already when you upgraded to 1.5.10 but maybe you did not notice. Can you provide the logs of the container starting up where it says "Running migrations:" (on version 1.5.10)
you are right. in version 1.5.10 the same error is happening:
Checking configuration...
Waiting for database to be ready...
Database is ready
Migrating database
Operations to perform:
Apply all migrations: account, admin, auth, authtoken, contenttypes, cookbook, oauth2_provider, sessions, sites, socialaccount
Running migrations:
Traceback (most recent call last):
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)
psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: "2345232-cherry"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/recipes/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/migrations/operations/fields.py", line 235, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 830, in alter_field
self._alter_field(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/postgresql/schema.py", line 288, in _alter_field
super()._alter_field(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 1055, in _alter_field
self.execute(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
return super().execute(sql, None)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 201, in execute
cursor.execute(sql, params)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)
django.db.utils.DataError: invalid input syntax for type integer: "2345232-cherry"
Applying cookbook.0205_alter_food_fdc_id_alter_propertytype_fdc_id...Generating static files
js-reverse file written to /opt/recipes/cookbook/static/django_js_reverse
1 static file copied to '/opt/recipes/staticfiles', 647 unmodified, 1396 post-processed.
Done
[2024-01-23 19:45:40 +0100] [1] [INFO] Starting gunicorn 20.1.0
[2024-01-23 19:45:40 +0100] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2024-01-23 19:45:40 +0100] [1] [INFO] Using worker: gthread
[2024-01-23 19:45:40 +0100] [11] [INFO] Booting worker with pid: 11
[2024-01-23 19:45:40 +0100] [12] [INFO] Booting worker with pid: 12
[2024-01-23 19:45:41 +0100] [13] [INFO] Booting worker with pid: 13
I also checked the database, and the last migration in it is 0204_propertytype_fdc_id
ah ok interesting, now I understand. The fix is contained in 0204 but since that ran trough and the issue only appears in 0205 its still broken for people on your upgrade path.
You can try to manage.py migrate cookbook 0203
, then upgrade to 1.5.11 and everything should run trough just fine. I will look into if I can move the fix from 0204 to 0205 so that it works for people with your migration path.
/opt/recipes # source venv/bin/activate
(venv) /opt/recipes # ./manage.py migrate cookbook 0203
Operations to perform:
Target specific migration: 0203_alter_unique_contstraints, from cookbook
Running migrations:
Rendering model states... DONE
Unapplying cookbook.0204_propertytype_fdc_id... OK
Checking configuration... Waiting for database to be ready... Database is ready Migrating database Operations to perform: Apply all migrations: account, admin, auth, authtoken, contenttypes, cookbook, oauth2_provider, sessions, sites, socialaccount Running migrations: Applying cookbook.0204_propertytype_fdc_id... OK Applying cookbook.0205_alter_food_fdc_id_alter_propertytype_fdc_id... OK Applying cookbook.0206_rename_sticky_navbar_userpreference_nav_sticky_and_more... OK Applying cookbook.0207_space_logo_color_128_space_logo_color_144_and_more... OK Applying cookbook.0208_space_app_name_userpreference_max_owned_spaces... OK Applying socialaccount.0004_app_provider_id_settings... OK Applying socialaccount.0005_socialtoken_nullable_app... OK Applying socialaccount.0006_alter_socialaccount_extra_data... OK Generating static files js-reverse file written to /opt/recipes/cookbook/static/django_js_reverse
649 static files copied to '/opt/recipes/staticfiles', 1705 post-processed. Done [2024-01-25 20:12:37 +0100] [1] [INFO] Starting gunicorn 20.1.0 [2024-01-25 20:12:37 +0100] [1] [INFO] Listening at: http://0.0.0.0:8080 (1) [2024-01-25 20:12:37 +0100] [1] [INFO] Using worker: gthread [2024-01-25 20:12:37 +0100] [12] [INFO] Booting worker with pid: 12 [2024-01-25 20:12:37 +0100] [13] [INFO] Booting worker with pid: 13 [2024-01-25 20:12:37 +0100] [14] [INFO] Booting worker with pid: 14
Seems like everything worked. Thank you @vabene1111
Confirmed, working for me as well :)
thanks, go from 1.5.9 to 10, then shell into the container and then update the image to 11 also worked for me.
perfect, thank you. Sorry for the inconvenience, I hade hoped less people would be affected by this issue.
for the next version i moved the fix to migration 0205, that should work for all instances no matter on which version they were before
Thanks. I corrected issue 2911 following your guidance, and confirms it now works fine
Hey there, I just upgraded to the latest version of the docker image (1.15.2) (setup with Synology Login Portal (=nginx) as reverse proxy) and am now greeted with the same error 500 page.
Help is very much appreciated.
That's a different error, please read the message, you have some duplicates that need to be manually migrated due to a change in the data structure.
Thanks for the quick response, I will take a closer look.
Solution in https://github.com/TandoorRecipes/recipes/issues/2894#issuecomment-1910826564
Tandoor Version
1.5.10
Setup
Unraid
Reverse Proxy
SWAG
Other
PostgresQL logs
Multiple entries in open-tandoor-data have an non-integer fdc_id:
So this migration will likely fail for anyone who has (at all) imported open-data
Bug description
On boot, it seems some pre-existing entry in my database is causing a startup error. Rolling back to
1.5.10
seems to 'solve' the startup error.Please let me know if you need me to dump/share some table for ease of use debugging.
Relevant logs