Restituisce 500 quando si richiedono avatar personalizzati degli utenti

I tried to upload a custom avatar, it could be succesfully uploaded, but when requesting https://example.com/user_avatar/example.com/example_user/96/11_2.png, it just returned 500 error. The default anonymous avatar has no this error.

Latest master Discourse branch.
Cloudflare R2 is used as my S3 storage.

Are you on an unsupported-install?

In any case 500 alone isn’t sufficient information. Please share the related log info and someone might help you.

2 Mi Piace

Of course. By the way, I have used Cloudflare R2 (S3-compatible) to store upload content, when I checked out files in the bucket, the avatar file was actually there, but clients could not access it with https://example.com/user_avatar/example.com/example_user/96/11_2.png, it’s so weird.

In production.log, I found this line:

Processing by UserAvatarsController#show as PNG
  Parameters: {"hostname" => "example.com", "username" => "example_user", "size" => "288", "version" => "12_2"}
Completed 418  in 599ms (Views: 4.1ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.4ms)

This may be related to:

Could be an S3 issue with the latest version :thinking:.

Okay, wish it is just a problem belong to the current nightly version. It is solved by setting a proxy.

Hey @MoRanYue, could you elaborate more on how you solved it?

I facing the same problem.

Thanks

@avidseeker
When you use a OSS service and your server can’t access it, for example, you are in China and your server’s connections to Cloudflare R2 are blocked by the local ISP. When clients try to acquire custom avatar resources, your server has to acquire it from the OSS, but failing, then returning 500 to the clients.

In my case, setting two env vars: HTTP_PROXY and HTTPS_PROXY to a proxy server which is able to access your OSS service. If you installed Discourse with standard installation, in your app.xml it should have a field called env, add those two variables and then you can run. I used unsupported installation and use Systemd to manage Discourse, so I added two Environment parameters in the .service file.

I don’t know whether your country has network censor system. If so, I can assume you already know what to do; If not, check out your OSS service’s online status and your settings about S3.

1 Mi Piace