XF 2.1 Editing avatar throws error with S3

Covert

Member
This error is only thrown if you try to edit the avatar. You just have to move it in any direction and try to save it. If I disable the add-on the exception is no longer thrown.


InvalidArgumentException: User does not have an 'o' avatar (data://avatars/o/41/41485.jpg)

Code:
#0 src/XF/Pub/Controller/Account.php(478): XF\Service\User\Avatar->setImageFromExisting()
#1 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Account->actionAvatar(Object(XF\Mvc\ParameterBag))
#2 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Account', 'Avatar', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Account), NULL)
#3 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Account), NULL)
#4 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#6 src/XF.php(391): XF\App->run()
#7 index.php(20): XF::runApp('XF\\Pub\\App')
#8 {main}

Storage config:
PHP:
$s3 = function () {
return new \Aws\S3\S3Client([
'credentials' => [
'key' => '{AWS_ACCESS_KEY_ID}',
'secret' => '{AWS_SECRET_ACCESS_KEY}'
],
'use_path_style_endpoint' => true,
'region' => '',
'version' => 'latest',
'endpoint' => 'https://{AWS_ENDPOINT}'
]);
};

$config['fsAdapters']['data'] = function () use ($s3) {
return new \League\Flysystem\AwsS3v3\AwsS3Adapter($s3(), '{AWS_BUCKET_NAME}', 'data');
};

$config['fsAdapters']['internal-data'] = function () use ($s3) {
return new \League\Flysystem\AwsS3v3\AwsS3Adapter($s3(), '{AWS_BUCKET_NAME}', 'internal_data');
};

$config['externalDataUrl'] = function ($externalPath, $canonical) {
return 'https://{AWS_CUSTOM_ENDPOINT}/{AWS_BUCKET_NAME}/data/' . $externalPath;
};

This is being uploaded to a MinIO server and use_path_style_endpoint is set to true.

Example External URL: https://minio.example.com/bucket/data/avatars/o/1/1234.jpg

Any help is appreicated!
 

Mike

XenForo developer
Staff member
Reading this again, if you say it doesn't error when S3 is disabled, that would presumably imply that the "o" avatar exists locally and thus must predate the switch to S3. That leads me to believe that this might indicate an issue with the initial data sync to S3.

I haven't seen any other reports of something like this (with the S3 add-on) so I'd guess it's more likely to be something specific to your situation.
 

Covert

Member
Reading this again, if you say it doesn't error when S3 is disabled, that would presumably imply that the "o" avatar exists locally and thus must predate the switch to S3. That leads me to believe that this might indicate an issue with the initial data sync to S3.

I haven't seen any other reports of something like this (with the S3 add-on) so I'd guess it's more likely to be something specific to your situation.

The error was a signature mismatch and seems to only happen if you crop the avatar and save it.

I was able to fix the error by applying these rules in Cloudflare:


I will take a deeper dive when I have the time to see why it only happens when cropping the image and saving.
 
Top