LiveView Upload External/S3 to filebase.com results in External client failure error

anybody have experience with s3.filebase.com instead of s3.amazonaws.com for getting a presigned url with that simple_s3_upload.ex that Chris McCord made? I’m getting a failure with the same settings that works with amazonaws but not filebase.com:

meta: %{
  fields: %{
    "acl" => "public-read",
    "content-type" => "image/jpeg",
    "key" => "input/280ba797-2c40-4d2e-bf64-597208d459c0.jpg",
    "policy" => "ewogICJleHBpcmF0aW9uIjogIjIwMjItMDctMTlUMTc6MzQ6NDUuNjU4OTYyWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImJ1Y2tldCI6ICAiaGFyZHNheWluZ3MtbWFpbiJ9LAogICAgWyJlcSIsICIka2V5IiwgImlucHV0LzI4MGJhNzk3LTJjNDAtNGQyZS1iZjY0LTU5NzIwOGQ0NTljMC5qcGciXSwKICAgIHsiYWNsIjogInB1YmxpYy1yZWFkIn0sCiAgICBbImVxIiwgIiRDb250ZW50LVR5cGUiLCAiaW1hZ2UvanBlZyJdLAogICAgWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDAsIDUwMDAwMDAwMF0sCiAgICB7IngtYW16LXNlcnZlci1zaWRlLWVuY3J5cHRpb24iOiAiQUVTMjU2In0sCiAgICB7IngtYW16LWNyZWRlbnRpYWwiOiAiMjFERTc1QTgwNkJDNjkxQzk2RTYvMjAyMjA3MTkvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJ9LAogICAgeyJ4LWFtei1hbGdvcml0aG0iOiAiQVdTNC1ITUFDLVNIQTI1NiJ9LAogICAgeyJ4LWFtei1kYXRlIjogIjIwMjIwNzE5VDE3MzQ0NVoifQogIF0KfQo=",
    "x-amz-algorithm" => "AWS4-HMAC-SHA256",
    "x-amz-credential" => "21DE75A806BC691C96E6/20220719/us-east-1/s3/aws4_request",
    "x-amz-date" => "20220719T173445Z",
    "x-amz-server-side-encryption" => "AES256",
    "x-amz-signature" => "347e5a0c7b8e780ef449288102f0f7c341369ceb486863b829052501be3a4a8c"
  },
  key: "input/280ba797-2c40-4d2e-bf64-597208d459c0.jpg",
  uploader: "S3",
  url: "//my-cool-bucket-main.s3.filebase.com"
}

I’ve confirmed the folder input exists
"key" => "input/280ba797-2c40-4d2e-bf64-597208d459c0.jpg",

I also tried re-arranging the bucket to the end of the url so that it renders like this:

url: "//s3.filebase.com/my-cool-bucket-main"

but this returns with “Exteral client failure” still.

This is the simple_s3_uploader.ex I’m using:

I needed to switch to https:// scheme, and also place the bucket name in the path.

I hit a roadblock without a workaround though. Filebase currently supports PutObject but not PostObject. I believe LiveView Upload uses PostObject under the hood, so I don’t think I can use LiveView with filebase.com. It could still be possible to use ExAws.S3 instead(but I don’t think I will get upload progress updates).

Data transfer for external uploads is 100% userland. The Direct to S3 example in the guides has the complete code for an XHR POST uploader on the client but you could modify it however you’d like. :slight_smile:

2 Likes

I’ve yet to resolve this issue for userland uploads to filebase.com(no issues uploading to filebase.com with ex_aws_s3). I changed the call to PUT but now getting a 403 so it’s something on my end and not related to LiveView Upload.

Make sure presigned PUT requests are enabled on the bucket.