Aws-sdk-php: Fatal error: Cannot instantiate abstract class Aws\ClientSideMonitoring\AbstractMonitoringMiddleware

Created on 5 Oct 2018  路  17Comments  路  Source: aws/aws-sdk-php

I get this error when using s3 client

investigating

Most helpful comment

Quick fix is to do:

composer require aws/aws-sdk-php:3.52.0

All 17 comments

Can you provide a code sample & PHP version (and any relevant context), as well as the full stack trace of the error message?

I am having the same issue when updating to v3.69.0 with psr7 1.4.1 and calling Aws\Sqs\SqsClient.
I quickly reverted back to 3.18.23 and guzzlehttp/psr7 1.4.0

```ErrorException: Cannot instantiate abstract class Aws\ClientSideMonitoring\AbstractMonitoringMiddleware

1 /invintus/Invintus-coreSys/vendor/aws/aws-sdk-php/src/ClientSideMonitoring/AbstractMonitoringMiddleware.php(83): handleFatalError

```            $credentialProvider,
            $options,
            $region,
            $service
        ) {
            return new static( <-- crash here
                $handler,
                $credentialProvider,
                $options,
                $region,
                $service

php 5.5.9

@scottf-tvw Can you also provide a code sample and stack trace, if available?

I will try to get something posted this weekend.

Can you provide a code sample & PHP version (and any relevant context), as well as the full stack trace of the error message?

$credentials = new Aws\Credentials\Credentials($this->config['AWS_ACCESS_KEY_ID'] , $this->config['AWS_SECRET_ACCESS_KEY']);

$s3_client = new S3Client([
    'version' => $this->config['version'],
    'region'  => $this->config['region'],
    'credentials'  => $credentials,
]);

try {
$s3_client->putObject([
    'Bucket' => $this->config['Bucket'],
    'Key' => $file['name'],
    'Body' => fopen($file['path'], 'r'),
    'ACL' => $this->config['ACL'],
]);

} catch (Aws\S3\Exception\S3Exception $e) {
    echo "There was an error uploading the file.\n";
    echo $e->getMessage();
}
}

@luudv, Thanks for the code sample. Can you tell me your exact PHP version and the full stack trace of the error (if one was output)?

@howardlopez I have exactly the same error with a version
PHP 5.5.9-1ubuntu4.25 (cli) (built: May 10 2018 14:37:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

But no problem with a php version 5.6.35 locally.

just reversion to old one

Hi @quickly3
Yes, AWS-SDK-PHP rollback has version 3.67.20 it works on php 5.5.9

Okay, to which version the SDK has to be rolledback for this to work?

Quick fix is to do:

composer require aws/aws-sdk-php:3.52.0

before 3.69.0 - 2018-10-04

Log
3.69.0 - 2018-10-04
...
Aws\ClientSideMonitoring - Code for future SDK instrumentation and telemetry.
...

Same problem here with version 3.69.*
For me it's working with version 3.67.*

Thanks for the additional data, everyone. It looks like this issue occurs for earlier versions of PHP 5.5.x, which contained a bug with late static bindings and closures. As already alluded to in this thread, you have a couple quick fix options:

  • As a temporary fix, you can revert to an SDK release before 3.69.0
  • If you have the ability, you can update PHP to the latest patch version - PHP 5.5.38 does not contain the bug, and neither does 5.6+

We're also working on a fix to avoid the condition triggering the bug in PHP, so that earlier versions of 5.5 can continue functioning properly. We'll update this thread when it is available.

A fix for this issue has been merged into the repository and is available for pulling on the master branch. For those using Composer, the changes will be incorporated into the next release.

@howardlopez, thank you for the patch!

The fix is now included in the release 3.69.4.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sm2017 picture sm2017  路  4Comments

carlalexander picture carlalexander  路  4Comments

pihish picture pihish  路  3Comments

Intrepidity picture Intrepidity  路  4Comments

aanton picture aanton  路  4Comments