Skip to content

Signature mismatch error for S3Store #122

Description

@ghisvail

I am trying to store a docx file in S3 and its query metadata in postgres using sqlalchemy-media. My S3 provider is not AWS. I use Minio for testing and a private cloud provider, both of which are advertised as "S3 compatible".

However, my attempts so far have failed with the following signature mismatch error:

The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method.

It works fine if I provide an alternative store backed by the filesystem instead, so I suppose the issue has to be with the S3 store rather than the model.

My model looks similar to this:

from sqlalchemy_media import File

class MyDocument(File):
    __directory__ = "my-directory"
    __prefix__ = "my-document"

class MyReport(Base):
    __tablename__ = "my_report"
    id = Column(Integer, primary_key=True, autoincrement=True)
    year = Column(Integer, nullable=False)
    document = Column(MyDocument.as_mutable(JSON), nullable=False)

And the store setup:

from sqlalchemy_media import StoreManager
from sqlalchemy_media import S3Store, FileSystemStore

def get_s3_store():
    return S3Store(
        bucket=None,  # Bucket name prefixed to endpoint
        access_key=my_access_key,
        secret_key=my_secret_key,
        region=None,  # No region support, also tried with eu-west-1
        base_url=some_base_url,
        prefix=my_bucket_name,
    )

def get_fs_store():
    return FileSystemStore(
        root_path="/tmp/sqlalchemy-media",
        base_url="static.mydomain.com",
    )

# File upload works with this setup
StoreManager.register("fs", get_fs_store, default=True)

# File upload fails with this setup
StoreManager.register("s3", get_s3_store, default=True)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions