Skip to content

Endpoint error for all S3 requests #70

@tmattio

Description

@tmattio

I am trying to use the S3 API. I tried both ListObjects and GetObjects.

For both, the result is the same - the answer from the server is not the one expected:

<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
...
</ListAllMyBucketsResult>

Vs

<?xml version="1.0" encoding="UTF-8"?>
<GetObjectOutput>
...
</GetObjectOutput>

Here is the code I use:

let downloadFile = (filename) => {
  let settings = Config.settings;

  let run_request =
    Aws_lwt.Runtime.run_request(
      ~access_key=settings.accessKey,
      ~secret_key=settings.secretKey,
      ~region=settings.region,
      (module Aws_s3.GetObject),
      Aws_s3.Types.GetObjectRequest.make(
        ~bucket=settings.bucket,
        ~key=filename,
        (),
      ),
    );

  Lwt_main.run(run_request);
};

Where settings.bucket = "bucket-name" and settings.region = "us-east-1".

When reading the documentation, I am under the impression that the host endpoint to target should be:
bucket-name.s3.amazonaws.com, but from what I see, the library targets s3.amazonaws.com, which might explain issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions