thaiphan/magento2-s3

report.CRITICAL: Unable to unserialize value, string is corrupted.

jobrandon opened this issue · 16 comments

Hi,

I execute the bin/magento s3:storage:export
and got this error.
{"exception":"[object] (InvalidArgumentException(code: 0): Unable to unserialize value, string is corrupted. at /var/www/html/stg/vendor/magento/framework/Serialize/Serializer/Serialize.php:38)"} []

Hi @jobrandon,
This might have been caused by an old bug that should be addressed by the latest version. Can you confirm what version you're using?
Regards,
Thai

Magento version 2.2.3. I found out that the problem is a unserializing the custom headers.

Have you resolved the problem or do you still need assistance?

My solution was a quick fix. I removed the custom header which actually not necessary for my use.

Then I got this message. Is this related to the fix?

<?xml version=\"1.0\" encoding=\"UTF-8\"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>2EC08E0523DBAF47</RequestId><HostId>a/MrVnQgp2Yhm1jrl9AbXtcigMGSK8lbfswr4wEGQxln/G7Pb+lWrAbzLbGPGLrmu4Elvs3maZ0=</HostId></Error> at /var/www/html/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:191, GuzzleHttp\\Exception\\ClientException(code: 403): Client error: PUT https://s3.ap-southeast-1.amazonaws.com/images-app.testing.com/assets/external/images/icons/icons_48-browsing-white.png` resulted in a 403 Forbidden response:

AccessDeniedAccess Denied2EC08E (truncated...)
at /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)"} []
[2018-06-28 06:41:18] report.CRITICAL: Error executing "PutObject" on "https://s3.ap-southeast-1.amazonaws.com/images-app.testing.com/assets/external/images/icons/icons_48-browsing-white.png"; AWS HTTP error: Client error: PUT https://s3.ap-southeast-1.amazonaws.com/images-app.testing.com/assets/external/images/icons/icons_48-browsing-white.png resulted in a 403 Forbidden response:`

That reads like your S3 credentials are incorrect. Can you review s3:config:list and see if everything is correct?

Thanks!, it works fine now. The only thing now is the custom header whenever necessary to use it.

Hey @jobrandon

Yeah, I'm planning on adding some new CLI tools for that as well eventually. Good to see everything is working now!

I'll be closing this ticket then.

Best of luck with your store.

Regards,

Thai

Hi @jobrandon,

how you resoled this issue. i am also getting same issue.

report.CRITICAL: Unable to unserialize value, string is corrupted. {"exception":"[object] (InvalidArgumentException(code: 0): Unable to unserialize value, string is corrupted. at /spdata/specapps/vansdev4/vendor/magento/framework/Serialize/Serializer/Serialize.php:38)"} []

Thanks
Poonam

Hi @thaiphan ,

Can you please suggest, how i can fix this issue.

Thanks

Hi @jobrandom

Could you please let us know how you resolved that access denied issue

I have set $meta['ACL' =>'public-write']; in s3.php
But still issue persist

@thai you please also suggest the solution

Thanks

Hi @vijaydcyb Try this one
Thai\S3\Model\MediaStorage\File\Storage\S3

public function getMetadata()
{
	$meta = [];
	/*$headers = $this->helper->getCustomHeaders();
	if ($headers) {
		$unserializedHeaders = $this->serializer->unserialize($headers);
		foreach ($unserializedHeaders as $header) {
			$meta[$header['header']] = $header['value'];
		}
	}*/
	return $meta;
}

Hi @jobrandon

Hi already tried this. Commented the code but while adding images from admin it throws the access denied error

The credentials are correct ones

hi @jobrandon
Thanks that worked for me.

Hi @jobrandon, @cybpoonam, @keyurbhagat80

Sorry for taking so long to get back to you!

As described in #55, I have pushed up v1.3.2 that should hopefully resolve this problem. Can you update to the latest version of the extension and tell me if it's working now?

Regards,

Thai

I'm closing this ticket. If problems persist, feel free to reply here or open a new ticket!