Aws\Exception\CredentialsException: Error retrieving credentials

Created on 25 April 2023, over 1 year ago

Hi! S3 file system works fine with credentials supplied by the key module, validates and all is good.

When I change to CORS upload, try to edit a node with a video field, get the following error.

Aws\Exception\CredentialsException: Error retrieving credentials from the instance profile metadata service. (cURL error 28: Connection timed out after 1000 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)) in Aws\Credentials\InstanceProfileProvider->handleRetryableException() (line 264 of /home/mysite/public_html/vendor/aws/aws-sdk-php/src/Credentials/InstanceProfileProvider.php).

I tried deleting authentication by the key module, added to settings.php, still same error.

Most appreciate any guidance.

πŸ› Bug report
Status

Active

Component

Code

Created by

πŸ‡«πŸ‡·France liliplanet Cannes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @liliplanet
  • πŸ‡ΊπŸ‡ΈUnited States aasarava

    I'm having the same issue. S3FS validation shows that the authentication to my S3 bucket is working just fine. But when I try to create a new node that has an S3 Cors field on it, the module times out and I get the following error.

    Aws\Exception\CredentialsException: Error retrieving credentials from the instance profile metadata service. (cURL error 28: Connection timed out after 1012 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://169.254.169.254/latest/meta-data/iam/security-credentials/) in Aws\Credentials\InstanceProfileProvider->handleRetryableException() (line 300 of /app/vendor/aws/aws-sdk-php/src/Credentials/InstanceProfileProvider.php).
    

    I'm not sure why it's trying to access the 169.254.169.254 local AWS endpoint, since I'm not running this on an EC2 instance.

    This appears to get triggered from this SDK call in Element/S3fsCorsFile.php:

          $sessionToken = $sts->getFederationToken([
            'Name' => 'User1',
            'DurationSeconds' => '3600',
            'Policy' => json_encode([
              'Statement' => [
                'Sid' => 'drupals3fscorsid' . time(),
                'Action' => [
                  "s3:PutObject",
                  "s3:GetObjectAcl",
                  "s3:GetObject",
                  "s3:DeleteObjectVersion",
                  "s3:PutObjectVersionAcl",
                  "s3:GetObjectVersionAcl",
                  "s3:DeleteObject",
                  "s3:PutObjectAcl",
                  "s3:GetObjectVersion",
                ],
                'Effect' => 'Allow',
                'Resource' => $sts_policy_resource,
              ],
            ]),
          ]);
    

    I do see that the version of the aws/aws-sdk-php library that I have is 3.325.3. I tried to downgrade to 3.18 as shown in s3fs's composer.json, but that conflicts with guzzle 7.

    Anyone have any suggestions? Is there an issue with my bucket or IAM setup that I need to resolve? Or is this due to a change in the SDK?

    (Changing this to a support request for now.)

Production build 0.71.5 2024