Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-48889

S3 repository errors are non-specific

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.4, 2.8.2, 2.9
    • Fix Version/s: 2.9
    • Component/s: Repositories
    • Labels:
    • Testing Instructions:
      Hide

      This test does not require an AWS account.

      1. Configure an S3 repository instance, with a nonsense word for the access key and another for the secret key.
      2. Set debug to developer level.
      3. Attempt to use the S3 repository.
        • Moodle will throw a moodle_exception, and tell you "Error while communicating with the repository '<yourreponamehere>'".
        • Verify that under "Debug info", the S3 library has printed the message

          S3::listBuckets(): [InvalidAccessKeyId] The AWS Access Key Id you provided does not exist in our records.
          

      Show
      This test does not require an AWS account. Configure an S3 repository instance, with a nonsense word for the access key and another for the secret key. Set debug to developer level. Attempt to use the S3 repository. Moodle will throw a moodle_exception, and tell you "Error while communicating with the repository '<yourreponamehere>'". Verify that under "Debug info", the S3 library has printed the message S3::listBuckets(): [InvalidAccessKeyId] The AWS Access Key Id you provided does not exist in our records.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48889-master

      Description

      When the S3 repository plugin runs into problems, the errors that are displayed are not descriptive.

      Reproduction steps (requires an AWS account):

      1. Configure an S3 repository instance; it is unimportant to create buckets.
      2. On your Moodle server, disable automatic time sync and change the time to be several hours before the current time.
      3. Attempt to use the S3 repository.
        • Moodle will throw a moodle_exception, and tell you "Error while communicating with the repository '<yourreponamehere>'".
        • The error code will be "errorwhilecommunicatingwith", which doesn't tell you what actually happened.
      4. Create a PHP file in your Moodle directory, s3test.php, with the following contents:

        <?php
        require_once("repository/s3/S3.php");
         
        $key_a = "your access key here";
        $key_s = "your secret access key here";
         
        S3::setAuth($key_a, $key_s);
         
        $buckets = S3::listBuckets(true);
         
        echo '<pre>';
        print_r($buckets);
        echo '</pre>';
         
        ?>
        

        • Amend the file with your access and secret access keys.
      5. Access the file you created in a web browser.
        • Observe that the S3 library gave you a meaningful message that was not passed up into Moodle, along the lines of
          Warning: S3::listBuckets(): [RequestTimeTooSkewed] The difference between the request time and the current time is too large.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/May/15