upload icon indicating copy to clipboard operation
upload copied to clipboard

URL incorrect with AWS S3 upload

Open daxpandhi opened this issue 5 years ago • 4 comments

Hello,

I've been using AWS S3 for storing the uploads. For the ARN, I had provided the Bucket ARN (incorrectly, I learned, since I am completely new to AWS) which caused issues. The log told me I needed an access point, which I set up and added in the ARN. Now uploads work, but the URL in the post editor after the upload is incorrect.

For example, this is what I get: [upl-image-preview url=https://arn:aws:s3:us-west-1:076786963819:accesspoint/quadflare.s3.us-west-1.amazonaws.com/2020-07-24/1595604947-819461-need-help-quadspinner-gaea-forum-firefox-devel-2020-07-24-1638.png]

While it should be: [upl-image-preview url=https://quadflare.s3.us-west-1.amazonaws.com/2020-07-24/1595604947-819461-need-help-quadspinner-gaea-forum-firefox-devel-2020-07-24-1638.png]

This is the extra prefix the URL contains: arn:aws:s3:us-west-1:076786963819:accesspoint/ (which is the value in my ARN field in the Fof/Upload plugin).

Is this a bug or maybe I have misconfigured something?

My Flarum version is 0.1.0-beta13, and Upload version is 0.9.2 - everything else (including local uploads) is fine.

Thank you, Dax

daxpandhi avatar Jul 24 '20 16:07 daxpandhi

Hi. Sorry we didn't get back to you earlier.

Unfortunately none of us know much about AWS either, we're just using the Flysystem driver for S3.

I'm not sure what that ARN bit is. If you're using S3 only (without cloudfront and such), you should be able to just fill in the bucket identifier ("Bucket") and datacenter ("Region") and the extension should be able to build a working URL.

clarkwinkelmann avatar Jul 28 '20 20:07 clarkwinkelmann

I'm not sure what that ARN bit is. If you're using S3 only (without cloudfront and such), you should be able to just fill in the bucket identifier ("Bucket") and datacenter ("Region") and the extension should be able to build a working URL.

The ARN is a unique resource identifier within AWS, but you're correct that it's not required in this case, the bucket name and the region should just work.

matteocontrini avatar Jul 29 '20 10:07 matteocontrini

Thanks, guys. I'll try that out. In the meantime, I had just edited the php file and hardcoded my URL prefix. :P

daxpandhi avatar Aug 04 '20 10:08 daxpandhi

Hi all - I just ran into this issue myself following the exact same path starting with using a bucket arn, looking in the logs, creating access point, etc. The solution, in my case anyways, was as simple as changing the "Bucket" configured in the s3 storage settings from arn:aws:s3:...:accesspoint/name to just the name of the access point as was suggested by others. Everything seems to be working fine now.

japetrus avatar Jul 21 '21 11:07 japetrus