Is it possible to upload files to Cloudflare R2 using Retool's native S3 resource?

Hi everyone,

We're working on a back-office application that will manage many types of files that are going to be served using Cloudflare R2.
Retool has native support for uploading files to S3 which works for us since R2 provides an S3-like API but it seems according to the documentation that AWS is the only possible target for such integration.

Has anyone done something similar? Can we satisfy this requirement using JavaScript instead?

1 Like

Hi @Omer_Katz,

Thanks for reaching out to our community!

Looking internally, it looks like we don't currently support this with our S3 integration, but we have a bug request on file to look into this further. I can post here if we make any progress on getting this to work with the integration!

It may be possible to connect to your resource with our Rest api integration in the meantime. It looks like we have some users trying that here

Let us know if that will work for you for now!

We would also like to use Cloudflare R2 as an s3 compatible storage in Retool, but we get the following error message when setting up the resource (button "test connection"):

Test connection failed
The region name 'eu-central-1' is not valid. Must be one of: wnam, enam, weur, eeur, apac, auto
The error message indicates that the region name 'eu-central-1' is not a valid region for the Amazon S3 API. To troubleshoot, you can check if the region name is spelled correctly and if it matches one of the valid region options: wnam, enam, weur, eeur, apac, or auto. Additionally, ensure that you are using the latest version of the Amazon S3 API and that your credentials are correctly configured.

Could you provide a way to set the region manually or fix this issue by using the special region names of Cloudflare R2? See also: Data location ยท Cloudflare R2 docs

We have also tried to implement an alternative solution using REST API integration, but fail to do so due to the complexity of creating a valid authorization header to upload an S3 object.

Hi @schaub,

Thanks for surfacing this & providing more details. We still have that bug request internally for supporting CloudFlare R2, as several users have reported that it isn't currently working with our S3 integration :disappointed: I'll let the team know another user reached out! I'll post here if we're able to ship a fix

Hi there @Tess

I'm also looking to upload files to R2 - I wanted to see if this is possible either through the native S3 resource or via the REST API integration. Doesn't seem like this thread or the other has the answer

Thanks

Hi @Cal,

I do see that a few customers have been able to work around this with a REST API (it's not something I've personally tested, but our REST integration should work with any rest api), but, unfortunately, it still doesn't appear to be possible to get our S3 connector working with Cloudflare R2 at the moment.

I'll reach back out if I get any updates internally about supporting this natively

Oh, that's so strange. It has worked well for me for several months, but recently I've been getting this error :

Unpleasant surprise to discover that R2 is not supported, I was sure it was!

Du you think it will be supported in a few time?

Hi @Floo, Cloudflare R2 support isn't something that's been picked up yet :slightly_frowning_face: But it wasn't something we removed support for :thinking: Do any of the listed region names work?

Hi @Tess, in the S3 ressource, there is no option to set the region name independently than the "Retool region".
The region name 'eu-central-1' is not an option that I can change to wnam, enam, weur... It seems Retool build its S3 requests by using the "Retool region" configured in the ressource

If I set the ressource region to "us-west-2" I get this S3 error :

The region name 'us-west-2' is not valid...

I hope it can help!

Have a nice end of week

Ah my bad :person_facepalming: thanks for following up!

Hey @Tess and @Floo ,

Just wanted to chime in on this issue โ€“ I ran into the same roadblock with the fixed region selection in Retool's S3 resource.

However, I found a solution detailed in Cloudflare's documentation: using "us-east-1" as the region acts as an alias for their "auto" region. This essentially bypasses the region constraint.

I tested it out in Retool, and I can confirm that file operations work flawlessly within my apps when using "us-east-1". (As a sidenote, I did encounter a strange issue where the resource editor gave me a 403 error, but using the resource in an app worked fine).

So, it seems we can use the native integration after all, without resorting to a REST API workaround. Hopefully, this helps anyone else facing this issue, and maybe the Retool team can consider incorporating this information into the documentation or the resource itself.

2 Likes

Thank you for the message @rubendoe!

I can't choose us-east-1
image

But I see that there is 2 versions now:
image

And the version 2 make appears
image

Ok, I will try :slight_smile:

Thank you.