revsys / django-health-check

a pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server, celery processes, etc.

Home Page:https://readthedocs.org/projects/django-health-check/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with S3Boto3StorageHealthCheck Failing After Upgrading to django-health-check 3.18.0 on Django 5.0

krystofbe opened this issue · comments

Hello,

I've recently encountered an issue with the django-health-check package, specifically version 3.18.0. After upgrading from 3.17.0 to 3.18.0, the S3Boto3StorageHealthCheck started failing, despite functioning correctly in the previous version.

Upon investigating the source code, I noticed that the failure seems to be occurring at this line in backends.py. It appears that self.storage_alias is None when used with S3Boto3StorageHealthCheck.

I am wondering if anyone else has experienced this issue after the upgrade and if there are any known workarounds or fixes. Any insights or assistance in resolving this would be greatly appreciated.

Thank you!

Seeing the same issue. Error did not exist previously (i.e., on 3.17.0).

same issue. Here my traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/health_check/storage/backends.py", line 75, in check_status
    file_name = self.check_save(file_name, file_content)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/health_check/storage/backends.py", line 54, in check_save
    file_name = storage.save(file_name, ContentFile(content=file_content))
                ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'save'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/health_check/backends.py", line 30, in run_check
    self.check_status()
  File "/usr/local/lib/python3.11/site-packages/health_check/storage/backends.py", line 79, in check_status
    raise ServiceUnavailable("Unknown exception") from e
health_check.exceptions.ServiceUnavailable: unavailable: Unknown exception

I submitted a pull request here: #415

until this is merged you can use my PR via poetry add git+https://github.com/krystofbe/django-health-check or stick to 3.17.0

@krystofbe off to take a look

I submitted a pull request here: #415

That PR is merged and (I think) released. Should this issue be marked as resolved?