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

S3: invalid request #227

Closed
mrkkrp opened this issue Mar 14, 2017 · 3 comments
Closed

S3: invalid request #227

mrkkrp opened this issue Mar 14, 2017 · 3 comments

Comments

@mrkkrp
Copy link

mrkkrp commented Mar 14, 2017

I can't upload a file to S3, my usage is pretty straightforward:

{-# LANGUAGE OverloadedStrings #-}

module Main where

import Control.Monad
import Control.Monad.Trans.Resource (runResourceT)
import qualified Aws
import qualified Aws.Core as AC
import qualified Aws.S3 as S3
import qualified Network.HTTP.Client as L
import qualified Network.HTTP.Client.TLS as L

main :: IO ()
main = do
  creds <- AC.makeCredentials
    "access key" -- access key
    "secret access key" -- secret access key
  let awsConfig = Aws.Configuration
        { Aws.timeInfo = Aws.Timestamp
        , Aws.credentials = creds
        , Aws.logger = Aws.defaultLog Aws.Warning }
      s3Config = Aws.defServiceConfig
  manager <- L.newManager L.tlsManagerSettings
  void . runResourceT . Aws.pureAws awsConfig s3Config manager $
    S3.putObject "my-bucket" "something.txt" (L.RequestBodyBS "foo!")

And S3 says:

S3Error
  { s3StatusCode = Status {statusCode = 400, statusMessage = "Bad Request"}
  , s3ErrorCode = "InvalidRequest"
  , s3ErrorMessage = "The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256."
  , s3ErrorResource = Nothing
  , s3ErrorHostId = Just "UIs9WGFfyQ4szjtQHYiEL/OTPeFyKgtHhdNRO2B+vDRJDE+0Bi2GPvB9FCZ6hkN4xqrfRqL8cVo="
  , s3ErrorAccessKeyId = Nothing
  , s3ErrorStringToSign = Nothing
  , s3ErrorBucket = Nothing
  , s3ErrorEndpointRaw = Nothing
  , s3ErrorEndpoint = Nothing }

Maybe it's time to start using what it says to use?

@mrkkrp
Copy link
Author

mrkkrp commented Mar 14, 2017

OK, looks like Frankfurt does not supprot V2. Could we merge #199 so I can at least put and get objects?

@mrkkrp
Copy link
Author

mrkkrp commented Mar 14, 2017

I'll try amazonka instead, if aws still has such problems in 2017, I'm not sure about using it.

@aristidb
Copy link
Owner

Using amazonka is probably a more future-proof choice if it works for you. To be honest, if I had known that amazonka's approach of generating APIs from descriptor files is possible, I would've done it too.

As for #199, it's a work-in-progress and I don't think it's ready for merging.

I'm neither actively using nor developing on "aws" myself, but I do generally try to merge pull requests when they're ready for merging.

Given that you said you want to use amazonka and given that not supporting Frankfurt is a known issue, I will close this issue.

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

2 participants