Errors trying to use custom S3 storage

As I’m constantly frustrated by breakage of the Azure Blob Storage plugin, I’ve run a Flexify.IO server to translate the Azure into S3 protocol.

However, after setting into Discourse, it doesn’t work. The error is:

Failed to open TCP connection to support.xxx.xxx.xxx.xxx:443 (getaddrinfo: Name or service not known)

where xx.xx.xx.xx is the IP address of the S3 gateway and support is the bucket name…

Funny thing is… I’ve used S3 Browser to test the end-point and it just works.

So can some kind soul let me know what it is I’ve done wrong?

I can only see it is potentially due to the region, as the region exposed by the endpoint is eastasia (a valid Azure region) but I can only choose from standard AWS regions in a list. Nevertheless, it is still strange because the error seems to indicate failure to connect to the endpoint itself, and not a region mismatch.

I have a feeling that my setting for the s3_bucket is wrong, since it is appending the bucket name to the endpoint URL itself.

Should I use the bucket/folder formet instead? What should I put in either one?

EDIT: From the source, it seems to be hard-coded in. What if my storage provider does not use the bucket name as a prefix?

You should try to follow the documentation on Using Object Storage for Uploads (S3 & Clones) for your use case. It’s a lot more flexible. When you get it working you can add it to the wiki too!

2 Likes

Given this:

Then this is definitely wrong:

The error message says as much. getaddrinfo: Name or service not known is a DNS lookup failure; There will never be a hostname like “support.303.303.303.303”.

Where did you get the “support” part from?

The flexify documentation says:

Change S3 endpoint that your application use to s3.flexify.io (on [sic] another hostname shown in the settings).

So you can’t use the admin console to change it, instead read the topic @falco mentions :arrow_double_up: and start with:

  DISCOURSE_S3_ENDPOINT: https://s3.flexify.io
2 Likes

Oh, sorry. support is the bucket name. I can see that S3 simply prepends the bucket name to the domain name, and this is assumed by Discourse.

Yes, I figured that much. So I must hard-code the end-points in app.yaml, correct?

@Falco @schleifer Alright, I’ve tried it, but unfortunately it is still giving me the exact same error.

Therefore, I don’t think it works even when hard-coded into app.yaml. They seem to go into the same code stream.

This is my app.yaml setting:

  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: eastasia
  DISCOURSE_S3_ENDPOINT: https://??.??.??.??
  DISCOURSE_S3_ACCESS_KEY_ID: ???
  DISCOURSE_S3_SECRET_ACCESS_KEY: ???
  DISCOURSE_S3_BUCKET: support

It is still trying to access support.??.??.??.??:443

So, I suppose in Discourse the bucket must form a sub-domain?

EDIT 1

Alright, I’ve scrapped the app.yaml settings and created a sub-domain with support on it that points to xx.xx.xx.xx. Now, when I upload, it spins for a long time, and then came back with a generic error:

Aws::S3::Errors::BadRequest

Is there a way to get the exact error message?

Have you tried checking the /logs page?

Yes, but there is nothing there…

What is the exact value you are using for the endpoint env var?

OK, I found a setting in Flexify.IO to set sub-domain mode. It is now working. :champagne:

I’ll update the wiki!

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