Seems like a recent (?) django update has caused the healthchecks-migration service to fail due to breaking changes on django 5.1:
Sep 29 10:38:26 phobos manage.py[1527]: Operations to perform:
Sep 29 10:38:26 phobos manage.py[1527]: Apply all migrations: accounts, admin, api, auth, contenttypes, logs, payments, sessions
Sep 29 10:38:26 phobos manage.py[1527]: Traceback (most recent call last):
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/n99kmkwidyac9fs0072i61sd48f2bng9-healthchecks-3.4/opt/healthchecks/manage.py", line 17, in <module>
Sep 29 10:38:26 phobos manage.py[1527]: raise e
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/n99kmkwidyac9fs0072i61sd48f2bng9-healthchecks-3.4/opt/healthchecks/manage.py", line 13, in <module>
Sep 29 10:38:26 phobos manage.py[1527]: execute_from_command_line(sys.argv)
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_comm>
Sep 29 10:38:26 phobos manage.py[1527]: utility.execute()
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
Sep 29 10:38:26 phobos manage.py[1527]: self.fetch_command(subcommand).run_from_argv(self.argv)
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
Sep 29 10:38:26 phobos manage.py[1527]: self.execute(*args, **cmd_options)
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
Sep 29 10:38:26 phobos manage.py[1527]: output = self.handle(*args, **options)
Sep 29 10:38:26 phobos manage.py[1527]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
Sep 29 10:38:26 phobos manage.py[1527]: res = handle_func(*args, **kwargs)
Sep 29 10:38:26 phobos manage.py[1527]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 303, in handle
Sep 29 10:38:26 phobos manage.py[1527]: pre_migrate_apps = pre_migrate_state.apps
Sep 29 10:38:26 phobos manage.py[1527]: ^^^^^^^^^^^^^^^^^^^^^^
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
Sep 29 10:38:26 phobos manage.py[1527]: res = instance.__dict__[self.name] = self.func(instance)
Sep 29 10:38:26 phobos manage.py[1527]: ^^^^^^^^^^^^^^^^^^^
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/migrations/state.py", line 565, in apps
Sep 29 10:38:26 phobos manage.py[1527]: return StateApps(self.real_apps, self.models)
Sep 29 10:38:26 phobos manage.py[1527]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/migrations/state.py", line 626, in __init__
Sep 29 10:38:26 phobos manage.py[1527]: self.render_multiple([*models.values(), *self.real_models])
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/migrations/state.py", line 664, in render_multiple
Sep 29 10:38:26 phobos manage.py[1527]: model.render(self)
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/migrations/state.py", line 957, in render
Sep 29 10:38:26 phobos manage.py[1527]: return type(self.name, bases, body)
Sep 29 10:38:26 phobos manage.py[1527]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/models/base.py", line 143, in __new__
Sep 29 10:38:26 phobos manage.py[1527]: new_class.add_to_class("_meta", Options(meta, app_label))
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/models/base.py", line 371, in add_to_class
Sep 29 10:38:26 phobos manage.py[1527]: value.contribute_to_class(cls, name)
Sep 29 10:38:26 phobos manage.py[1527]: File "/nix/store/9hak5p0ms0k4qsw5f46xggmvshqjq03p-python3.12-django-5.1.1/lib/python3.12/site-packages/django/db/models/options.py", line 220, in contribute_to_class
Sep 29 10:38:26 phobos manage.py[1527]: raise TypeError(
Sep 29 10:38:26 phobos manage.py[1527]: TypeError: 'class Meta' got invalid attribute(s): index_together
Sep 29 10:38:27 phobos systemd[1]: healthchecks-migration.service: Main process exited, code=exited, status=1/FAILURE
Steps To Reproduce
Not really sure if this needs a specific upgrade path since it seems to be from migrations, but after the fix (see below) no migrations were run, so perhaps this happens every time.
Steps to reproduce the behavior:
Configure healthchecks with services.healthchecks
See that healthchecks-migration has failed (maybe?)
Expected behavior
healthchecks-migration should complete successfully.
Healthchecks 4.5 adds support for Django 5.1, so an upgrade to that version should fix the issue. Unfortunately, the automatic PR seems to be failing tests (#337086).
Describe the bug
I'm running (this specific package) on
nixos-unstable
30439d93eb8b19861ccbe3e581abf97bdc91b093 (config at https://github.com/diogotcorreia/dotfiles/tree/6d6d17361a0a161a315f0904eb5411cb05e6b559). This happened after upgrading from ad416d066ca1222956472ab7d0555a6946746a80.Seems like a recent (?) django update has caused the
healthchecks-migration
service to fail due to breaking changes on django 5.1:Steps To Reproduce
Not really sure if this needs a specific upgrade path since it seems to be from migrations, but after the fix (see below) no migrations were run, so perhaps this happens every time.
Steps to reproduce the behavior:
services.healthchecks
healthchecks-migration
has failed (maybe?)Expected behavior
healthchecks-migration
should complete successfully.Additional context
The error seems related to a breaking change for Django 5.1, where they removed
index_together
fromclass Meta
.Healthchecks 4.5 adds support for Django 5.1, so an upgrade to that version should fix the issue. Unfortunately, the automatic PR seems to be failing tests (#337086).
Alternative fix
This is the fix upstream: https://github.com/healthchecks/healthchecks/commit/b5eced26cf9c0d527840220aeb7e414f247d1c1f
I'm currently applying this fix to my config, see the commit https://github.com/diogotcorreia/dotfiles/commit/735b87b23a20f896ccfe4f5951eca38b141873ac; it fixes the issue for now, and
healthchecks-migration
can run successfully:Notify maintainers
@phaer
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.