Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Django to 5.1.2 and update dependencies #4568

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

ttys0dev
Copy link
Contributor

Some more dependency updates.

@mlissner
Copy link
Member

Can you post some release notes, please? That makes review a ton easier.

pyproject.toml Outdated Show resolved Hide resolved
daphne = "^4.1.2"
httpx = {extras = ["http2"], version = "^0.27.2"}
django-model-utils = "^4.5.1"
django-permissions-policy = "^4.21.0"
django-model-utils = "^5.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertisfu, this looks like a big version bump. Can you confirm it's OK?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This it's good. But found an issue related to django-storages described in detail below.

pyproject.toml Outdated Show resolved Hide resolved
@mlissner
Copy link
Member

This LGTM, pending Alberto's last review. Alberto, if you want to merge, that'd be great.

@ttys0dev ttys0dev force-pushed the update-django branch 4 times, most recently from b5862a5 to 5a93ae5 Compare October 14, 2024 17:43
@ttys0dev
Copy link
Contributor Author

rebased

@albertisfu
Copy link
Contributor

I reviewed this in detail, and it looks good except for the django-storages update. It breaks file operations, at least in development.

For instance, I'm encountering an issue during a file upload, specifically during a HEAD operation:

ClientError: An error occurred (400) when calling the HeadObject operation: Bad Request
  File "django/core/handlers/exception.py", line 42, in inner
    response = await get_response(request)
  File "django/core/handlers/base.py", line 253, in _get_response_async
    response = await wrapped_callback(
  File "django/contrib/admin/options.py", line 718, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "django/utils/decorators.py", line 188, in _view_wrapper
    result = _process_exception(request, e)
  File "django/utils/decorators.py", line 186, in _view_wrapper
    response = view_func(request, *args, **kwargs)
  File "django/views/decorators/cache.py", line 80, in _view_wrapper
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/sites.py", line 241, in inner
    return view(request, *args, **kwargs)
  File "django/contrib/admin/options.py", line 1964, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "django/utils/decorators.py", line 48, in _wrapper
    return bound_method(*args, **kwargs)
  File "django/utils/decorators.py", line 188, in _view_wrapper
    result = _process_exception(request, e)
  File "django/utils/decorators.py", line 186, in _view_wrapper
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/options.py", line 1820, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "django/contrib/admin/options.py", line 1871, in _changeform_view
    self.save_model(request, new_object, form, not add)
  File "django/contrib/admin/options.py", line 1294, in save_model
    obj.save()
  File "cl/search/models.py", line 1629, in save
    super().save(update_fields=update_fields, *args, **kwargs)
  File "django/db/models/base.py", line 891, in save
    self.save_base(
  File "model_utils/tracker.py", line 426, in inner
    return original(instance, *args, **kwargs)
  File "django/db/models/base.py", line 997, in save_base
    updated = self._save_table(
  File "django/db/models/base.py", line 1124, in _save_table
    (getattr(self, f.attname) if raw else f.pre_save(self, False)),
  File "django/db/models/fields/files.py", line 338, in pre_save
    file.save(file.name, file.file, save=False)
  File "django/db/models/fields/files.py", line 99, in save
    self.name = self.storage.save(name, content, max_length=self.field.max_length)
  File "django/core/files/storage/base.py", line 44, in save
    name = self.get_available_name(name, max_length=max_length)
  File "cl/lib/storage.py", line 83, in get_available_name
    return get_name_by_incrementing(self, name, max_length)
  File "cl/lib/storage.py", line 52, in get_name_by_incrementing
    while instance.exists(name):
  File "storages/backends/s3.py", line 587, in exists
    self.connection.meta.client.head_object(Bucket=self.bucket_name, Key=name)
  File "botocore/client.py", line 569, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "botocore/client.py", line 1023, in _make_api_call
    raise error_class(parsed_response, operation_name)

https://freelawproject.sentry.io/issues/5991462937/

Initially, I thought the issue was related to the boto3 update, but it's not.

I confirmed the issue is specific to django-storages 1.14.4, as version 1.14.3 works correctly.

The issue could be related to jschneier/django-storages#1437.

We need to confirm whether this is a permission issue with developer credentials, a problem with environment variable settings that need to be adjusted, or a bug in django-storages.

For now, I think if we want this to be merged, we can downgrade django-storages to version 1.14.3.

@ttys0dev
Copy link
Contributor Author

For now, I think if we want this to be merged, we can downgrade django-storages to version 1.14.3.

Downgraded to 1.14.3.

@albertisfu
Copy link
Contributor

Downgraded to 1.14.3.

Thanks merging this one. And I'll open an issue regarding 1.14.4 issue.

@albertisfu albertisfu merged commit c1bfbd9 into freelawproject:main Oct 14, 2024
9 checks passed
@ttys0dev ttys0dev deleted the update-django branch October 14, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants