Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credentials.php is not able to unserialise the cached tokenKey #149

Open
jordikroon opened this issue Aug 3, 2022 · 0 comments
Open

Credentials.php is not able to unserialise the cached tokenKey #149

jordikroon opened this issue Aug 3, 2022 · 0 comments
Labels

Comments

@jordikroon
Copy link

Description

We sometimes see an error that is triggered by the awd-sdk caused by the aws-s3 plugin. The error is fairly vague, and most of our projects seem to have this issue.

Overall the plugin is working as it should, but at random moments we receive the error:

yii\base\ErrorException
 
/home/tde/domains/domain.tld/releases/42/vendor/aws/aws-sdk-php/src/Credentials/Credentials.php in yii\base\ErrorHandler::handleError

Trying to access array offset on value of type null

The full path this error is taking is as following:
createAdapter is calling _getConfigArray then buildConfigArray with a valid access key and secret.

This is then calling the buildConfigArray method where it is reaching the following block of code:

if (Craft::$app->cache->exists($tokenKey) && !$refreshToken) {
    $cached = Craft::$app->cache->get($tokenKey);
    $credentials->unserialize($cached);
}

The unserialize method is receiving a parameter with value false. It seems that even though $tokenKey exists, it is false.

Something like this would most likely fix the issue:

if (!$refreshToken && $cached = Craft::$app->cache->get($tokenKey)) {
    $credentials->unserialize($cached);
}
@jordikroon jordikroon added the bug label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant