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

Review django-storages 1.14.4 upgrade #4571

Open
albertisfu opened this issue Oct 14, 2024 · 0 comments
Open

Review django-storages 1.14.4 upgrade #4571

albertisfu opened this issue Oct 14, 2024 · 0 comments

Comments

@albertisfu
Copy link
Contributor

On #4568 we found that upgrading to django-storages 1.14.4 broke file operations.
So we didn't upgrade to this version and instead used 1.14.3

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/

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

We need to confirm whether this is a permission issue with the developer credentials, a problem with environment variable settings that need adjustment, or a bug in django-storages, so we can safely upgrade to django-storages in the future.

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

No branches or pull requests

1 participant