question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set versioning to ENABLED (using set_bucket_versioning)

See original GitHub issue

Using minio container in docker-compose services with Django (3.2.6) DRF (3.12.4) and minio (7.1.0). Had such docker-compose config:

  web:
    container_name: web
    restart: always
    command: "python manage.py runserver 0.0.0.0:7000"
    build: .
    ports:
      - "7000:7000"
    env_file:
      - ./.env
    volumes:
      - .:/usr/src/app/
    depends_on:
      - db
    networks:
      - api

  minio:
    image: minio/minio
    container_name: minio
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - data1:/data
    env_file:
      - ./.env.minio
    command: server --console-address ":9001" /data
    networks:
      - api


networks:
    api:
        driver: bridge
volumes:
  postgres_data:
  data1:

And such class for creating client and default bucket

from minio import Minio
from minio.commonconfig import ENABLED
from minio.versioningconfig import VersioningConfig
from project.settings import (
    MINIO_DEFAULT_URL,
    MINIO_DEFAULT_ACCESS,
    MINIO_DEFAULT_SECRET,
    MINIO_DEFAULT_BUCKET,
)


class LocalStorage:
    DEFAULT_URL = MINIO_DEFAULT_URL
    DEFAULT_ACCESS = MINIO_DEFAULT_ACCESS
    DEFAULT_SECRET = MINIO_DEFAULT_SECRET
    DEFAULT_BUCKET = MINIO_DEFAULT_BUCKET

    def __init__(self, url=None, access_key=None, secret_key=None):
        self.url = url if url else self.DEFAULT_URL
        self.access_key = access_key if access_key else self.DEFAULT_ACCESS
        self.secret_key = secret_key if secret_key else self.DEFAULT_SECRET
        self.client = self.__create_client()

    def __create_client(self):
        return Minio(self.url, self.access_key, self.secret_key, secure=False)

    def bucket(self, bucket=None):
        bucket = bucket if bucket else self.DEFAULT_BUCKET
        if self.client.bucket_exists(bucket):
            bucket = list(filter(lambda x: x.name == bucket, self.client.list_buckets())).pop(0)
        else:
            bucket = self.client.make_bucket(bucket)
        self.client.set_bucket_versioning(self.DEFAULT_BUCKET, VersioningConfig(ENABLED, ENABLED))
        return bucket

Getting, putting objects works fine, but no one object with version_id. Found that I have to set versioning for my default bucket, but I receive such error (get_bucket_version() does not raise error - interesting thing): minio.error.S3Error: S3 operation failed; code: NotImplemented, message: A header you provided implies functionality that is not implemented, resource: /documents, request_id: 16B59A..., host_id: 45f6e8b7..., bucket_name: documents What’s wrong or any suggestions how to avoid this error?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
harshavardhanacommented, Nov 8, 2021

Single drive setups do not support enabling bucket versioning.

^^ the answer

0reactions
lazorikvcommented, Nov 8, 2021

Single drive setups do not support enabling bucket versioning.

Do I have to use smth like minio/mc? I mean create bucket with versioning as a separate service? And then connect via SDK? (Just started using minio, sorry for probably stupid question)

same question

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetBucketVersioning - Amazon Simple Storage Service
Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with...
Read more >
s3:GetBucketVersioning/PutBucketVersioning fails with 403
Set bucket policy to give permission to another user from same or different tenant to GetBucketVersioning/PutBucketVersioning. It fails with ...
Read more >
AWS S3 Versioning: How to enable and suspend using AWS ...
In this article, we will look at how to enable and suspend versioning. Enabling versioning using AWS CLI. Versioning applies to all the...
Read more >
S3 Bucket - getBucketVersioning returns circular response if ...
Describe the bug Executing getBucketVersioning will lead to a circular response if neither versioning nor MFA is set for the bucket.
Read more >
Unable to get the Versioning Status of a S3 bucket created ...
Create a S3 bucket with a bucket name i.e. ... getBucketVersioning(GetBucketVersioningRequest.builder().bucket(**<BucketName>**).build()).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found