KnpGaufretteBundle icon indicating copy to clipboard operation
KnpGaufretteBundle copied to clipboard

stream writer can't write folders to S3

Open aherlambang opened this issue 11 years ago • 5 comments

I have the following config:

knp_gaufrette:
    adapters:
        amazon:
            amazon_s3: 
                amazon_s3_id: site_store.s3
                bucket_name: %site_store.bucket_name%
                create: true

filesystems:
    amazon:
        adapter: amazon

stream_wrapper:
    protocol: s3
    filesystems:
        - amazon

assetic:
    read_from:      %cdn_path_prod%
    write_to:       %cdn_path_prod%

however when I try to dump all of the assets it always gives me:

[RuntimeException]                          
  Unable to create directory s3://amazon/css  

I've looked at the following thread (https://github.com/Cybernox/AmazonWebServicesBundle) and it says to return true in the mkdir function, I did that however it's still erroring. Any idea?

aherlambang avatar Apr 18 '13 08:04 aherlambang

+1

cassianotartari avatar Oct 01 '14 00:10 cassianotartari

+1

hugohenrique avatar Oct 21 '14 21:10 hugohenrique

I didn't used KnpGaufretteBundle more to write at S3, my solution: http://stackoverflow.com/a/26146562/1983572 maybe don't need to create the StreamWrapperS3 in the answer as a service, just instantiate it getting parameters with $this->container->getParameter('name')

cassianotartari avatar Oct 21 '14 22:10 cassianotartari

This works somewhat if you switch to aws sdk 3.0 and change the aws initialization like so:

    aws_s3.client:
        class: Aws\S3\S3Client
        factory_class: Aws\S3\S3Client
        factory_method: 'factory'
        arguments:
            -
                credentials:
                    key: %amazon_aws_key%
                    secret: %amazon_aws_secret_key%
                region: 'us-east-1'
                version: 'latest'

bassrock avatar May 28 '15 01:05 bassrock

The only issue now is the content-types get set wrong

bassrock avatar May 28 '15 01:05 bassrock