Coder Social home page Coder Social logo

pipes-s3's People

Contributors

bgamari avatar edsko avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

domenkozar

pipes-s3's Issues

Bad request error when using toS3WithManager

ghci reproduction of error below - the request work fine with vanilla s3 where I use conduit to build streaming body (no multi-part upload - it is vanilla streaming request where length is known). The object size here is 2MB btw, while chunk size is 8MB.

I used the latest git version of pipes-s3 for testing.

*Main> Just creds <- Aws.loadCredentialsFromEnv
*Main> let cfg = Aws.Configuration Aws.Timestamp creds (Aws.defaultLog Aws.Error)
*Main> httpmgr <- newManager tlsManagerSettings
*Main> let file ="out"
*Main>   inhandle <- openFile file ReadMode
*Main>   lenb <- System.IO.withFile file ReadMode hFileSize
*Main>   let inbytes = P.fromHandle inhandle :: Producer' P.ByteString IO ()
*Main>  PS3.toS3WithManager httpmgr cfg (1024*1024*8) "indalytics-dev" "testbucket/pre/test" inbytes
*** Exception: S3Error {s3StatusCode = Status {statusCode = 400, statusMessage = "Bad Request"}, s3ErrorCode = "MalformedXML", s3ErrorMessage = "The XML you provided was not well-formed or did not validate against our published schema", s3ErrorResource = Nothing, s3ErrorHostId = Just "vmngyN2a1LYkY7a/1+Ha/DLdK5iaN8F5CTed36o3/MSImUoWUbvKoAjzOqSnEH0ivKPQtmEXs8g=", s3ErrorAccessKeyId = Nothing, s3ErrorStringToSign = Nothing, s3ErrorBucket = Nothing, s3ErrorEndpointRaw = Nothing, s3ErrorEndpoint = Nothing}

s3cfg should be passed as second argument to http manager

s3cfg values can differ from app to app. So, it should be mandatory argument to HTTP manager. This is one example of how it is set it in aws package - AWS.pureAws on last line is the API of interest here for one way of how S3 configuration is passed:

 Just creds <- Aws.loadCredentialsFromEnv
  let cfg = Aws.Configuration Aws.Timestamp creds (Aws.defaultLog Aws.Error)
  let s3cfg = S3.s3 Aws.HTTP S3.s3EndpointUsClassic False
  {- Set up a ResourceT region with an available HTTP manager. -}
  httpmgr <- newManager tlsManagerSettings
  req <- async $ runResourceT $ do
    Aws.pureAws cfg s3cfg httpmgr $ {...request body here}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.