Error copying object in Tigris

I have run into a problem doing a copy in Tigris. I’m in Elixir using the latest versions of ex_aws and ex_aws_s3.

from_bucket = "my-bucket"
to_bucket = from_bucket
from_key = "landing/file.txt"
to_key = "archive/file.txt"

ExAws.S3.put_object_copy(
  to_bucket,
  to_key,
  from_bucket,
  from_key
)
|> ExAws.request()

Running this in S3 works fine. In Tigris I get 10 failed attempts and then this error.

{:error,
 {:http_error, 500,
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InternalError</Code><Message>We encountered an internal errors, please try again.</Message><Resource>/my-bucket/archive/file.txt</Resource><RequestId>...</RequestId><Key>archive/file.txt</Key><BucketName>my-bucket</BucketName></Error>"}}

Other operations have been working with this bucket, so it doesn’t seem to be a credentials issue.

> Application.get_all_env :ex_aws
[
  s3: [scheme: "https://", host: "fly.storage.tigris.dev", region: "auto"],
  region: [{:system, "AWS_REGION"}, :instance_role],
  debug_requests: true,
  secret_access_key: "...",
  json_codec: Jason,
  access_key_id: "..."
]

Added storage, tigris

I will take a look to see what’s going on.

1 Like

@justindotpub, the issue with the copy object API is fixed now.

Here is what was happening.
The way the copy object API works is that the source object is passed around using the header x-amz-copy-source. All the SDKs except for ExAws set the header value in the bucket-name/object-key format. Which is how we were expecting it to be set. However, ExAws sets the value in the format /bucket-name/object-key. Notice the leading /. This was causing the copy object requests from ExAws to fail.

We have fixed the issue by supporting both ways of specifying the source object.

2 Likes

Fabulous! It is working now. Thank you for the quick turn around.

You bet :+1:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.