Author Topic: S3 UploadBytes throwing error  (Read 434 times)

plokij909

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
S3 UploadBytes throwing error
« on: April 06, 2018, 11:52:20 PM »
Hi - I've just updated my ChilkatDLL and I'm now getting an error when using s3_uploadByes - "Bad Request" - did something change in the function call?

binaryRequestX:
        binaryRequest:
          fullRequest:
            a_synchronousRequest:
              generateRequestHeader:
                httpRequestGenStartLine:
                  genStartLine:
                    startLine: PUT /xxx/xxxx.jpg HTTP/1.1
                  --genStartLine
                --httpRequestGenStartLine
                addCookies:
                  Not auto-adding cookies.
                  sendCookies: 1
                  cookieDir:
                --addCookies
              --generateRequestHeader
              fullHttpRequest:
                domain: files.xxxx.com.s3-ap-southeast-2.amazonaws.com
                port: 443
                ssl: 1
                openHttpConnection:
                  Opening connection directly to HTTP server.
                  httpHostname: files.xxxx.com.s3-ap-southeast-2.amazonaws.com
                  httpPort: 443
                  tls: 1
                  HTTPS secure channel established.
                --openHttpConnection
                connectTime: Elapsed time: 670 millisec
                sendRequestHeader:
                  sendHeaderElapsedMs: 0
                --sendRequestHeader
                sendRequestBody:
                  sendBodyElapsedMs: 0
                --sendRequestBody
                statusCode: 400
                statusText: Bad Request

                checkCloseConnection:
                  Response includes connection:close header (or proxy-connection:close header)
                --checkCloseConnection
              --fullHttpRequest
              success: 1
            --a_synchronousRequest
            success: 1
          --fullRequest
          responseStatus: 400
          Failed.
        --binaryRequest
      --binaryRequestX
      responseBody:
    --s3__uploadData
    Failed.
  --S3_UploadBytes
--ChilkatLog

Chilkat

  • Administrator
  • Full Member
  • *****
  • Posts: 103
  • Karma: +6/-0
    • View Profile
Re: S3 UploadBytes throwing error
« Reply #1 on: April 07, 2018, 12:18:02 PM »
Make sure to set both the AwsRegion and AwsEndpoint properties.
For example:

http.AwsRegion = "ap-southeast-2";
http.AwsEndpoint = "s3-ap-southeast-2.amazonaws.com";


plokij909

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: S3 UploadBytes throwing error
« Reply #2 on: April 08, 2018, 07:23:11 AM »
That worked! Thank you!